MC-E / DragonDiffusion

ICLR 2024 (Spotlight)
Apache License 2.0
726 stars 21 forks source link

content dragging时遇到问题 #23

Open DesperateZero opened 8 months ago

DesperateZero commented 8 months ago

点击Edit后,DDIM Inversion结束以后,Start Editing开始即报错。Log如下

Seed set to 42 DDIM Inversion: 100%|██████████████████████████████████████████████████████████████████████████████████| 50/50 [00:06<00:00, 8.20it/s] Start Editing: 0%| | 0/50 [00:01<?, ?it/s] Traceback (most recent call last): File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\gradio\queueing.py", line 407, in call_prediction output = await route_utils.call_process_api( File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\gradio\route_utils.py", line 226, in call_process_api output = await app.get_blocks().process_api( File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\gradio\blocks.py", line 1550, in process_api result = await self.call_function( File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\gradio\blocks.py", line 1185, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread return await future File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\anyio_backends_asyncio.py", line 851, in run result = context.run(func, args) File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\gradio\utils.py", line 661, in wrapper response = f(args, kwargs) File "E:\DragonDiffusion-master\src\demo\model.py", line 318, in run_drag latent_rec = self.editor.pipe.edit( File "E:\DragonDiffusion-master\src\models\Sampler.py", line 80, in edit guidance = self.guidance_drag(latent=latent, latent_noise_ref=latent_noise_ref[-(i+1)], t=t, text_embeddings=text_embeddings_org, energy_scale=energy_scale, edit_kwargs) File "E:\DragonDiffusion-master\src\models\Sampler.py", line 297, in guidance_drag cond_grad_con = torch.autograd.grad(loss_conenergy_scale, latent)[0] File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\torch\autograd__init__.py", line 303, in grad return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\torch\autograd\function.py", line 274, in apply return user_fn(self, args) File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\torch\autograd\function.py", line 522, in wrapper outputs = fn(ctx, *args) File "C:\Users\Oven\anaconda3\envs\py38\lib\site-packages\xformers\ops\fmha__init__.py", line 92, in backward query, key, value, out, lse = ctx.saved_tensors RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [8, 1, 2304]] is at version 1; expected version 0 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

stackzero00 commented 2 months ago

@DesperateZero I occured same issue, Did you fix this error?

stackzero00 commented 1 month ago

I solved this issue. It is because CUDA version First time, I ran this project on CUDA 11.8, but it occurs inplace operation error in xformers fast multi-head attention(AKA. _fmha) Later I changed CUDA 12.2, this issue is disappeared