tin2tin / Pallaidium

PALLAIDIUM - a generative AI movie studio integrated in the Blender Video Editor.
GNU General Public License v3.0
981 stars 79 forks source link

Linux: I always have a Memory error, no matter which settings i use. #49

Closed Craanky closed 1 year ago

Craanky commented 1 year ago

Python: Traceback (most recent call last): File "/home/robin/.config/blender/3.6/scripts/addons/Pallaidium-main/init.py", line 2335, in execute image = pipe( File "/home/robin/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, kwargs) File "/home/robin/.local/lib/python3.10/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 861, in call noise_pred = self.unet( File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "/home/robin/.local/lib/python3.10/site-packages/accelerate/hooks.py", line 160, in new_forward args, kwargs = module._hf_hook.pre_forward(module, args, kwargs) File "/home/robin/.local/lib/python3.10/site-packages/accelerate/hooks.py", line 578, in pre_forward module.to(self.execution_device) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1145, in to return self._apply(convert) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) [Previous line repeated 5 more times] File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 820, in _apply param_applied = fn(param) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1143, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 14.00 MiB (GPU 0; 5.79 GiB total capacity; 4.55 GiB already allocated; 12.12 MiB free; 4.71 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

tin2tin commented 1 year ago

Try rendering fewer frames if it is video or if you output an image try lowering the resolution to ex. 768x384 or 640x320. As it seems you're only missing 14 mb. close any program using VRAM and restart Blender, that might give you the few MB you're missing for your current settings.

Let me know how it goes.

Craanky commented 1 year ago

i switched to 640x320 and it still didnt work This Error came up: Python: Traceback (most recent call last): File "/home/robin/.config/blender/3.6/scripts/addons/Pallaidium-main/init.py", line 2335, in execute image = pipe( File "/home/robin/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, kwargs) File "/home/robin/.local/lib/python3.10/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 861, in call noise_pred = self.unet( File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "/home/robin/.local/lib/python3.10/site-packages/accelerate/hooks.py", line 160, in new_forward args, kwargs = module._hf_hook.pre_forward(module, args, kwargs) File "/home/robin/.local/lib/python3.10/site-packages/accelerate/hooks.py", line 578, in pre_forward module.to(self.execution_device) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1145, in to return self._apply(convert) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) [Previous line repeated 6 more times] File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 820, in _apply param_applied = fn(param) File "/home/robin/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1143, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 26.00 MiB (GPU 0; 5.79 GiB total capacity; 4.46 GiB already allocated; 15.50 MiB free; 4.62 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

tin2tin commented 1 year ago

How much VRAM do you have? What are your settings in the add-on properties? What are your settings in the sidebar panel?

Did you follow the installation instructions? Did you get to the installation finished message without errors?

Craanky commented 1 year ago

6gb, default, default except changed the resolution to 640x320, I got the installation finished message without errors

Craanky commented 1 year ago

Screenshot from 2023-09-11 16-40-57

tin2tin commented 1 year ago

Thanks, looks similar to my settings. Does 512x256 work? (You do add a prompt, right?)

Craanky commented 1 year ago

512x256 does also not work and yes i added a prompt also rendering with the gpu stops working after i try to use the addon

Craanky commented 1 year ago

Screenshot from 2023-09-11 16-53-43

tin2tin commented 1 year ago

You properly need to add a light to that scene?

Hard for me to say why it doesn't work for you. Do you still have plenty of free space on your hdd after downloading the model? Maybe restating the computer will clean up the vram?

You could try SD 1.5 which is less VRAM hungry. Or try the video(after lowering the resolution)?

tin2tin commented 1 year ago

A wild guess is that it could be bc I'm using an older Nvidia driver: https://www.nvidia.com/download/driverResults.aspx/204474/en-us/ The later NVIDIA drives(532+) seemed to move rendering to CPU at an earlier VRAM level which caused slowdowns. Maybe they have changed that further in later drivers. What NVIDIA driver are you on?

Craanky commented 1 year ago

that was a bad example scene, but it still looks like this with lights (as you can see in the top left its out of memory) i already tried restarting and i have a lot of free space on my ssd. I just tried sd 1.5 and i got no error message but it just put out a black image strip. my nvidia driver version is: 525.125.06

tin2tin commented 1 year ago

Hmmm.... seems like nsfw prompts can result in a black screen. Try Google stable diffusion 1.5 black screen.

What if you try Bark/AudioLDM2 and audio output?

I guess CUDA is running fine when you restart Blender and work in the 3d space? (I never encountered the error from your screenshot)

Craanky commented 1 year ago

It only clears the vram that it used when i restart blender

Craanky commented 1 year ago

also when i click uninstall dependencies it says that the ai models are located at .cache/huggingface/transformers but they are located at .cache/huggingface/hub for me

Craanky commented 1 year ago

i tried it with audio, this error message came: Python: Traceback (most recent call last): File "/snap/blender/3915/3.6/python/lib/python3.10/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/snap/blender/3915/3.6/python/lib/python3.10/http/client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "/snap/blender/3915/3.6/python/lib/python3.10/http/client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/snap/blender/3915/3.6/python/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/snap/blender/3915/3.6/python/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/snap/blender/3915/3.6/python/lib/python3.10/http/client.py", line 976, in send self.connect() File "/snap/blender/3915/3.6/python/lib/python3.10/http/client.py", line 1455, in connect self.sock = self._context.wrap_socket(self.sock, File "/snap/blender/3915/3.6/python/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/snap/blender/3915/3.6/python/lib/python3.10/ssl.py", line 1071, in _create self.do_handshake() File "/snap/blender/3915/3.6/python/lib/python3.10/ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/robin/.config/blender/3.6/scripts/addons/Pallaidium-main/init.py", line 1816, in execute preload_models( File "/home/robin/.local/lib/python3.10/site-packages/bark/generation.py", line 330, in preloadmodels = load_codec_model(use_gpu=codec_use_gpu, force_reload=force_reload) File "/home/robin/.local/lib/python3.10/site-packages/bark/generation.py", line 297, in load_codec_model model = _load_codec_model(device) File "/home/robin/.local/lib/python3.10/site-packages/bark/generation.py", line 253, in _load_codec_model model = EncodecModel.encodec_model_24khz() File "/home/robin/.local/lib/python3.10/site-packages/encodec/model.py", line 279, in encodec_model_24khz state_dict = EncodecModel._get_pretrained(checkpoint_name, repository) File "/home/robin/.local/lib/python3.10/site-packages/encodec/model.py", line 262, in _get_pretrained return torch.hub.load_state_dict_from_url(url, map_location='cpu', check_hash=True) # type:ignore File "/home/robin/.local/lib/python3.10/site-packages/torch/hub.py", line 746, in load_state_dict_from_url download_url_to_file(url, cached_file, hash_prefix, progress=progress) File "/home/robin/.local/lib/python3.10/site-packages/torch/hub.py", line 611, in download_url_to_file u = urlopen(req) File "/snap/blender/3915/3.6/python/lib/python3.10/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) File "/snap/blender/3915/3.6/python/lib/python3.10/urllib/request.py", line 519, in open response = self._open(req, data) File "/snap/blender/3915/3.6/python/lib/python3.10/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/snap/blender/3915/3.6/python/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/snap/blender/3915/3.6/python/lib/python3.10/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/snap/blender/3915/3.6/python/lib/python3.10/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)>

Craanky commented 1 year ago

Screenshot from 2023-09-11 18-04-49

Craanky commented 1 year ago

it also dont clears the vram it used (see bottom right) as i said earlier

tin2tin commented 1 year ago

Things are getting further and further away from anything I've encountered and have any knowledge about.

As a last ditch attempt, try to read in the Torch bug report thread for how to uninstall dependencies and remove both dependencies and model folders, restart the computer and try reinstalling everything.

(You could have older python modules etc. and this way you'll get a clean install)

tin2tin commented 1 year ago

also when i click uninstall dependencies it says that the ai models are located at .cache/huggingface/transformers but they are located at .cache/huggingface/hub for me

Thanks for catching this, I'll correct it to hub.

tin2tin commented 1 year ago

my nvidia driver version is: 525.125.06

Another attempt could be to update this to a driver version around version 531.

Craanky commented 1 year ago

my nvidia driver version is: 525.125.06

Another attempt could be to update this to a driver version around version 531.

How do you update your driver on debian 12?

Craanky commented 1 year ago

i tried reinstalling btw, still didnt work

tin2tin commented 1 year ago

Oh, I'm Windows, I don't know anything about Linux.

Craanky commented 1 year ago

Thanks for trying to help still, maybe i should have said earlier that im on linux

tin2tin commented 1 year ago

I know that some people https://github.com/tin2tin/Pallaidium/pull/42 have it running on Linux, so if you figure out the Nvidia driver update on your OS, that might solve it?

tin2tin commented 1 year ago

Any progress?

Craanky commented 1 year ago

Any progress?

no, i think i already have the latest driver version for linux

tin2tin commented 1 year ago

Closing this, as I can't do support on an OS I do not have.