lkwq007 / lkwq007/stablediffusion-infinity

Cannot copy out of meta tensor; no data - Using SDv2.1

Open
#191 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.9k
Forks
294
PR merge metrics
No merged PRs in 30d

Description

Hi,

When running SDV2.1, when I upload an image and run a prompt, I get the following error:

C:\Users\miniforge3\envs\sd-inf\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion_inpaint_legacy.py:505: FutureWarning: The init_image argument is deprecated and will be removed in version 0.12.0. Please use image instead of init_image.
init_image = deprecate("init_image", "0.12.0", message, take_from=kwargs)
Traceback (most recent call last):
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\gradio\routes.py", line 337, in run_predict
output = await app.get_blocks().process_api(
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\gradio\blocks.py", line 1015, in process_api
result = await self.call_function(
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\gradio\blocks.py", line 833, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Users\stablediffusion-infinity-master\app.py", line 868, in run_outpaint
images = cur_model.run(
File "C:\Users\stablediffusion-infinity-master\app.py", line 759, in run
images = inpaint_func(
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion_inpaint_legacy.py", line 538, in call
latents, init_latents_orig, noise = self.prepare_latents(
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion_inpaint_legacy.py", line 408, in prepare_latents
init_latent_dist = self.vae.encode(image).latent_dist
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\diffusers\models\vae.py", line 566, in encode
h = self.encoder(x)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\diffusers\models\vae.py", line 130, in forward
sample = self.conv_in(sample)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\accelerate\hooks.py", line 151, in new_forward
args, kwargs = module._hf_hook.pre_forward(module, *args, **kwargs)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\accelerate\hooks.py", line 266, in pre_forward
return send_to_device(args, self.execution_device), send_to_device(kwargs, self.execution_device)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\accelerate\utils\operations.py", line 130, in send_to_device
return recursively_apply(_send_to_device, tensor, device, non_blocking, test_type=_has_to_method)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\accelerate\utils\operations.py", line 79, in recursively_apply
return honor_type(
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\accelerate\utils\operations.py", line 50, in honor_type
return type(obj)(generator)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\accelerate\utils\operations.py", line 82, in
recursively_apply(
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\accelerate\utils\operations.py", line 98, in recursively_apply
return func(data, *args, **kwargs)
File "C:\Users\miniforge3\envs\sd-inf\lib\site-packages\accelerate\utils\operations.py", line 123, in _send_to_device
return t.to(device, non_blocking=non_blocking)
NotImplementedError: Cannot copy out of meta tensor; no data!

Also worth saying here:
I am only able to upload image and run a prompt with version Stablediffusion-inpainting+img2img-1.5
All other ones are giving me an error about init_image except this version that gives me the meta tensor, no data! but by looking at the code errors here, it looks that resolving the meta tensor will help but will still have the init_image error like I have on the other versions.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app.py at the run_outpaint call around line 868 and run method around line 759, then reproduce the upload-and-prompt flow with SDv2.1 while checking the installed PyTorch and related pipeline dependencies. Compare it with the working Stablediffusion-inpainting+img2img-1.5 configuration; the issue is done when the target model completes the flow without the meta-tensor or init_image errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.