-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: only one element tensors can be converted to Python scalars #2
Comments
Hi there, This feels like a problem with a wrong version of diffusers. Could you please provide the full code snippet producing this exception, as well as the details of your python environment? (OS, python version, installed packages and versions) |
It does not arise from the version. change to "i" in line 208, mixdiff/tiling.py to "t" will fix this error. |
Just tried installing from diffusers import LMSDiscreteScheduler
from mixdiff import StableDiffusionTilingPipeline
# Creater scheduler and model (similar to StableDiffusionPipeline)
scheduler = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", num_train_timesteps=1000)
pipeline = StableDiffusionTilingPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", scheduler=scheduler, use_auth_token=True).to("cuda:0")
image = pipeline(
prompt=[[
"A charming house in the countryside, by jakub rozalski, sunset lighting, elegant, highly detailed, smooth, sharp focus, artstation, stunning masterpiece",
"A dirt road in the countryside crossing pastures, by jakub rozalski, sunset lighting, elegant, highly detailed, smooth, sharp focus, artstation, stunning masterpiece",
"An old and rusty giant robot lying on a dirt road, by jakub rozalski, dark sunset lighting, elegant, highly detailed, smooth, sharp focus, artstation, stunning masterpiece"
]],
tile_height=640,
tile_width=640,
tile_row_overlap=0,
tile_col_overlap=256,
guidance_scale=8,
seed=7178915308,
num_inference_steps=50,
)["sample"][0] So please do check you are using the correct version. |
Hi, thanks for your great work.
I am getting this issue?
# Mixture of Diffusers generation
After running I got error :
ValueError: only one element tensors can be converted to Python scalars
logs:
File ~/.virtualenvs/mix-of-diffusers/lib/python3.8/site-packages/torch/autograd/grad_mode.py:27, in _DecoratorContextManager.call..decorate_context(*args, **kwargs)
24 @functools.wraps(func)
25 def decorate_context(*args, **kwargs):
26 with self.clone():
---> 27 return func(*args, **kwargs)
File ~/mixture-of-diffusers/mixdiff/tiling.py:208, in StableDiffusionTilingPipeline.call(self, prompt, num_inference_steps, guidance_scale, eta, seed, tile_height, tile_width, tile_row_overlap, tile_col_overlap, guidance_scale_tiles, seed_tiles, seed_tiles_mode, seed_reroll_regions, cpu_vae)
206 # compute the previous noisy sample x_t -> x_t-1
207 if isinstance(self.scheduler, LMSDiscreteScheduler):
--> 208 latents = self.scheduler.step(noise_pred, i, latents, **extra_step_kwargs)["prev_sample"]
209 else:
210 latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs)["prev_sample"]
File ~/.virtualenvs/mix-of-diffusers/lib/python3.8/site-packages/diffusers/schedulers/scheduling_lms_discrete.py:217, in LMSDiscreteScheduler.step(self, model_output, timestep, sample, order, return_dict)
215 if isinstance(timestep, torch.Tensor):
216 timestep = timestep.to(self.timesteps.device)
--> 217 step_index = (self.timesteps == timestep).nonzero().item()
218 sigma = self.sigmas[step_index]
220 # 1. compute predicted original sample (x_0) from sigma-scaled predicted noise
ValueError: only one element tensors can be converted to Python scalars
The text was updated successfully, but these errors were encountered: