volotat / SD-CN-Animation

This script allows to automate video stylization task using StableDiffusion and ControlNet.
MIT License
806 stars 61 forks source link

txt2vid error on cuda only #36

Open enzyme69 opened 1 year ago

enzyme69 commented 1 year ago

issue with macOS cpu cuda only

Traceback (most recent call last):
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1075, in process_api
    result = await self.call_function(
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 898, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 549, in async_iteration
    return next(iterator)
  File "/Users/jimmygunawan/stable-diffusion-webui/extensions/SD-CN-Animation/scripts/base_ui.py", line 123, in process
    yield from txt2vid.start_process(*args)
  File "/Users/jimmygunawan/stable-diffusion-webui/extensions/sd-cn-animation/scripts/core/txt2vid.py", line 76, in start_process
    FloweR_load_model(args_dict['width'], args_dict['height'])
  File "/Users/jimmygunawan/stable-diffusion-webui/extensions/sd-cn-animation/scripts/core/txt2vid.py", line 51, in FloweR_load_model
    FloweR_model.load_state_dict(torch.load(model_path))
  File "/Users/jimmygunawan/stable-diffusion-webui/modules/safe.py", line 106, in load
    return load_with_extra(filename, extra_handler=global_extra_handler, *args, **kwargs)
  File "/Users/jimmygunawan/stable-diffusion-webui/modules/safe.py", line 151, in load_with_extra
    return unsafe_torch_load(filename, *args, **kwargs)
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 789, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 1131, in _load
    result = unpickler.load()
  File "/opt/homebrew/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pickle.py", line 1213, in load
    dispatch[key[0]](self)
  File "/opt/homebrew/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pickle.py", line 1254, in load_binpersid
    self.append(self.persistent_load(pid))
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 1101, in persistent_load
    load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 1083, in load_tensor
    wrap_storage=restore_location(storage, location),
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 215, in default_restore_location
    result = fn(storage, location)
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 182, in _cuda_deserialize
    device = validate_cuda_device(location)
  File "/Users/jimmygunawan/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/serialization.py", line 166, in validate_cuda_device
    raise RuntimeError('Attempting to deserialize object on a CUDA '
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
GoZippy commented 1 year ago

I have same issue - I want to init and run deserialization with AMD or CPU only - not sure how to get this to work with AMD or CPU only.

volotat commented 1 year ago

Please try to run it again on the new version of the extension. I tried to change the way FloweR is loaded. It might fix this issue.

Voyajer commented 1 year ago

Still happening to me on CPU on linux

Sp4Rx commented 1 year ago

Does anyone has any idea of changing it to CPU only?