Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screen/main.py Cannot re-initialize CUDA in forked subprocess. #17

Closed
yhyu13 opened this issue Dec 22, 2023 · 2 comments
Closed

screen/main.py Cannot re-initialize CUDA in forked subprocess. #17

yhyu13 opened this issue Dec 22, 2023 · 2 comments

Comments

@yhyu13
Copy link

yhyu13 commented Dec 22, 2023

ubutn 22.04 Cuda12.1 RTX3090

when running

cd example
python screen/main.py

And then press enter to start the subprocess, I am havving cuda cannot run on forked subprocess error

(streamdiffusion) hangyu5@yhyu13fuwuqi:~/Documents/Git-repoMy/AIResearchVault/repo/AIGC/game changer/StreamDiffusion/examples$ python screen/main.py
vae/diffusion_pytorch_model.safetensors not found
Loading pipeline components...:  14%|███████████████████▋                                                                                                                      | 1/7 [00:01<00:09,  1.59s/it]/home/hangyu5/anaconda3/envs/streamdiffusion/lib/python3.11/site-packages/transformers-4.36.2-py3.11.egg/transformers/models/clip/feature_extraction_clip.py:28: FutureWarning: The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use CLIPImageProcessor instead.
  warnings.warn(
Loading pipeline components...: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:03<00:00,  1.97it/s]
Traceback (most recent call last):
  File "/home/hangyu5/Documents/Git-repoMy/AIResearchVault/repo/AIGC/game changer/StreamDiffusion/examples/screen/../../utils/wrapper.py", line 413, in _load_model
    ).to(device=self.device, dtype=self.dtype)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hangyu5/anaconda3/envs/streamdiffusion/lib/python3.11/site-packages/diffusers-0.24.0-py3.11.egg/diffusers/pipelines/pipeline_utils.py", line 864, in to
    module.to(device, dtype)
  File "/home/hangyu5/anaconda3/envs/streamdiffusion/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1160, in to
    return self._apply(convert)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/hangyu5/anaconda3/envs/streamdiffusion/lib/python3.11/site-packages/torch/nn/modules/module.py", line 810, in _apply
    module._apply(fn)
  File "/home/hangyu5/anaconda3/envs/streamdiffusion/lib/python3.11/site-packages/torch/nn/modules/module.py", line 833, in _apply
    param_applied = fn(param)
                    ^^^^^^^^^
  File "/home/hangyu5/anaconda3/envs/streamdiffusion/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1158, in convert
    return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hangyu5/anaconda3/envs/streamdiffusion/lib/python3.11/site-packages/torch/cuda/__init__.py", line 284, in _lazy_init
    raise RuntimeError(
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method
Model load has failed. Doesn't exist.
@MoonEese
Copy link

https://github.com/cumulo-autumn/StreamDiffusion/tree/main/examples
Take a screen capture and process it. This script only works on Windows.

@yhyu13
Copy link
Author

yhyu13 commented Dec 22, 2023

Ok! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants