rinongal / textual_inversion

MIT License
2.87k stars 278 forks source link

Error when running inversion command #129

Open Cinemato opened 1 year ago

Cinemato commented 1 year ago

I am getting this error in the conda shell when I try to run the inversion command. Any help is appreciated 👍

inversion_error

At line:3 char:18

rinongal commented 1 year ago

Hi,

Can you please try running the entire command in one line (instead of having it split with each flag on a new line)?

Cinemato commented 1 year ago

Thank you that worked!

But now I am getting this memory error. I have 16 GBs of ram. Is that not enough?

RuntimeError: [enforce fail at ..\c10\core\CPUAllocator.cpp:76] data. DefaultCPUAllocator: not enough memory: you tried to allocate 2621440 bytes.

rinongal commented 1 year ago

It's enough, but you'll need to play a bit with the config files. Try reducing the batch size and using gradient accumulation batches to compensate (so if you cut the batch size by a factor of 2, add accumulate_grad_batches: 2 under 'trainer' in the config).

If you want more, there are re-implementations of our method with optimizations like xformers flash attention which should let you work with as little as 6GB. Try to look at the automatic1111 webui.

Cinemato commented 1 year ago

The problem was that there was no space in my C drive. Now After I cleared some space the inversion went further but now I am facing a new error.

RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 4.00 GiB total capacity; 3.44 GiB already allocated; 0 bytes free; 3.51 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

I tried to change the batch_size to 2 and I tried to change the size of training and validation to 192 and 128 but it is still the same. Not sure what to do at this point. Is there something else I can try to make this work? It is saying they only need to allocate 20 MBs so maybe there is a way? Also, why is it saying the capacity is 4 GBs when I have 16 GBs of ram? Maybe there is a mistake somewhere in my system.