gligen / GLIGEN

Open-Set Grounded Text-to-Image Generation
MIT License
1.97k stars 147 forks source link

RuntimeError: set_sizes_and_strides is not allowed on a Tensor created from .data or .detach(). #88

Open Hui-88 opened 1 month ago

Hui-88 commented 1 month ago

Has anyone encountered this error during training? I tried many methods but couldn't solve it:

Traceback (most recent call last): File "/data0/envs/SD/lib/python3.8/contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "/data0/envs/SD/lib/python3.8/site-packages/torch/random.py", line 125, in fork_rng yield File "/data0/envs/SD/lib/python3.8/site-packages/torch/utils/checkpoint.py", line 122, in backward outputs = ctx.run_function(detached_inputs) File "/data0/zhanghui/GLIGEN-master/ldm/modules/diffusionmodules/openaimodel.py", line 232, in _forward return self.skip_connection(x) + h File "/data0/envs/SD/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(input, **kwargs) File "/data0/envs/SD/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 446, in forward return self._conv_forward(input, self.weight, self.bias) File "/data0/envs/SD/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 442, in _conv_forward return F.conv2d(input, weight, bias, self.stride, RuntimeError: set_sizes_and_strides is not allowed on a Tensor created from .data or .detach(). If your intent is to change the metadata of a Tensor (such as sizes / strides / storage / storage_offset) without autograd tracking the change, remove the .data / .detach() call and wrap the change in a with torch.no_grad(): block. For example, change: x.data.set_(y) to: with torch.nograd(): x.set(y)

CondaError: KeyboardInterrupt