HVision-NKU / StoryDiffusion

Accepted as [NeurIPS 2024] Spotlight Presentation Paper
Apache License 2.0
5.94k stars 597 forks source link

ValueError: cannot find context for 'fork' #19

Open halr9000 opened 6 months ago

halr9000 commented 6 months ago

Windows 11. Tried using conda exactly as per instructions. No errors during pip.

(storydiffusion) PS E:\hal\pinokio\api\StoryDiffusion\app> python .\app.py
Traceback (most recent call last):
  File "E:\hal\pinokio\api\StoryDiffusion\app\app.py", line 4, in <module>
    import spaces
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\spaces\__init__.py", line 10, in <module>
    from .zero.decorator import GPU
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\spaces\zero\decorator.py", line 18, in <module>
    from .wrappers import regular_function_wrapper
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\spaces\zero\wrappers.py", line 42, in <module>
    Process = multiprocessing.get_context('fork').Process
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\multiprocessing\context.py", line 243, in get_context
    return super().get_context(method)
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\multiprocessing\context.py", line 193, in get_context
    raise ValueError('cannot find context for %r' % method) from None
ValueError: cannot find context for 'fork'
Z-YuPeng commented 6 months ago

HI, please use python gradio_app_sdxl_specific_id.py instead of python app.py

halr9000 commented 6 months ago

HI, please use python gradio_app_sdxl_specific_id.py instead of python app.py

That produces two other issues:

(storydiffusion) PS E:\hal\pinokio\api\StoryDiffusion\app> python .\gradio_app_sdxl_specific_id.py
WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
    PyTorch 2.0.1+cu118 with CUDA 1108 (you have 2.0.1+cpu)
    Python  3.10.11 (you have 3.10.14)
  Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
  Memory-efficient attention, SwiGLU, sparse and more won't be available.
  Set XFORMERS_MORE_DETAILS=1 for more details

[...snipping output from huggingface hub downloads]

and

Loading pipeline components...:  14%|█████████▎                                                       | 1/7 [00:00<00:01,  5.27it/s]
Traceback (most recent call last):
  File "E:\hal\pinokio\api\StoryDiffusion\app\gradio_app_sdxl_specific_id.py", line 430, in <module>
    pipe = StableDiffusionXLPipeline.from_pretrained(sd_model_path, torch_dtype=torch.float16, use_safetensors=True if use_va else False)
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\huggingface_hub\utils\_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1271, in from_pretrained
    loaded_sub_model = load_sub_model(
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 525, in load_sub_model
    loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\huggingface_hub\utils\_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\diffusers\models\modeling_utils.py", line 777, in from_pretrained
    model_file = _get_model_file(
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\huggingface_hub\utils\_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "C:\Users\hal\miniconda3\envs\storydiffusion\lib\site-packages\diffusers\utils\hub_utils.py", line 272, in _get_model_file
    raise EnvironmentError(
OSError: Error no file named diffusion_pytorch_model.bin found in directory C:\Users\hal\.cache\huggingface\hub\models--SG161222--RealVisXL_V4.0\snapshots\49740684ab2d8f4f5dcf6c644df2b33388a8ba85\vae.

The cuda version mismatch does not surprise me. Your requirements.txt is especially picky. I might suggest loosening up the version pinning, especially if you are going to have folks use both conda & pip,

Let me see if I can come up with a combination which will get me past that.