Skip to content

RuntimeError: Input type (c10::Half) and bias type (float) should be the same #7

@densechen

Description

@densechen

It is ok for use to generate images for the first time. However, it will raise the following error if we generate images for second time.

Traceback (most recent call last):
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/gradio/routes.py", line 321, in run_predict
    output = await app.blocks.process_api(
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/gradio/blocks.py", line 1006, in process_api
    result = await self.call_function(fn_index, inputs, iterator, request)
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/gradio/blocks.py", line 847, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "app.py", line 123, in infer
    images = pipe_refiner(prompt=prompt, negative_prompt=negative, image=images, num_inference_steps=steps, strength=refiner_strength, generator=g).images
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py", line 998, in __call__
    image = self.vae.decode(latents / self.vae.config.scaling_factor, return_dict=False)[0]
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/diffusers/utils/accelerate_utils.py", line 46, in wrapper
    return method(self, *args, **kwargs)
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/diffusers/models/autoencoder_kl.py", line 270, in decode
    decoded = self._decode(z).sample
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/diffusers/models/autoencoder_kl.py", line 256, in _decode
    z = self.post_quant_conv(z)
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 463, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/docker/software/anaconda3/envs/r3d/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 459, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (c10::Half) and bias type (float) should be the same

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions