nateraw / stable-diffusion-videos

Create 🔥 videos with Stable Diffusion by exploring the latent space and morphing between text prompts
Apache License 2.0
4.36k stars 417 forks source link

Error when running the test program #110

Open vincenzoml opened 1 year ago

vincenzoml commented 1 year ago

When running the test program described in README.md

import torch

pipeline = StableDiffusionWalkPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    torch_dtype=torch.float16,
    revision="fp16",
).to("cuda")

video_path = pipeline.walk(
    prompts=['a cat', 'a dog'],
    seeds=[42, 1337],
    num_interpolation_steps=3,
    height=512,  # use multiples of 64 if > 512. Multiples of 8 if < 512.
    width=512,   # use multiples of 64 if > 512. Multiples of 8 if < 512.
    output_dir='dreams',        # Where images/videos will be saved
    name='animals_test',        # Subdirectory of output_dir where images/videos will be saved
    guidance_scale=8.5,         # Higher adheres to prompt more, lower lets model take the wheel
    num_inference_steps=50,     # Number of diffusion steps per image generated. 50 is good default
)

I get the following error with python 3.9.7 on ubuntu

Traceback (most recent call last):
  File "/home/vincenzo/data/local/repos/stablediffusion-test/test.py", line 24, in <module>
    from stable_diffusion_videos import StableDiffusionWalkPipeline
  File "<frozen importlib._bootstrap>", line 1055, in _handle_fromlist
  File "/home/vincenzo/.local/lib/python3.9/site-packages/stable_diffusion_videos/__init__.py", line 73, in __getattr__
    submod = importlib.import_module(submod_path)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/vincenzo/.local/lib/python3.9/site-packages/stable_diffusion_videos/stable_diffusion_pipeline.py", line 5, in <module>
    import librosa
  File "/home/vincenzo/.local/lib/python3.9/site-packages/librosa/__init__.py", line 211, in <module>
    from . import decompose
  File "/home/vincenzo/.local/lib/python3.9/site-packages/librosa/decompose.py", line 19, in <module>
    import sklearn.decomposition
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/__init__.py", line 64, in <module>
    from .base import clone
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/base.py", line 14, in <module>
    from .utils.fixes import signature
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/utils/__init__.py", line 14, in <module>
    from . import _joblib
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/utils/_joblib.py", line 22, in <module>
    from ..externals import joblib
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/__init__.py", line 119, in <module>
    from .parallel import Parallel
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/parallel.py", line 28, in <module>
    from ._parallel_backends import (FallbackToBackend, MultiprocessingBackend,
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/_parallel_backends.py", line 22, in <module>
    from .executor import get_memmapping_executor
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/executor.py", line 14, in <module>
    from .externals.loky.reusable_executor import get_reusable_executor
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/externals/loky/__init__.py", line 12, in <module>
    from .backend.reduction import set_loky_pickler
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/externals/loky/backend/reduction.py", line 125, in <module>
    from sklearn.externals.joblib.externals import cloudpickle  # noqa: F401
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/externals/cloudpickle/__init__.py", line 3, in <module>
    from .cloudpickle import *
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py", line 152, in <module>
    _cell_set_template_code = _make_cell_set_template_code()
  File "/home/vincenzo/.local/lib/python3.9/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py", line 133, in _make_cell_set_template_code
    return types.CodeType(
TypeError: an integer is required (got type bytes)
nateraw commented 1 year ago

Thank you! I actually didn't run this before last release so will have a look asap

nateraw commented 1 year ago

can you send your environment info if that's not too much work?

stable_diffusion_videos version, python version, diffusers version, and your OS info?

vincenzoml commented 1 year ago

Thanks!

Python: 3.9.7 Ubuntu: 21.10 diffusers: 0.6.0 stable_diffusion_videos: 0.6.2

nateraw commented 1 year ago

Awesome thanks so much for quick response. Will hopefully be able to look into this later today.

Outside of test suite, did you run into any more concrete issues? If so, please feel free to file more issues.

vincenzoml commented 1 year ago

Well, I have no clue since I could not test it :)

nateraw commented 1 year ago

valid point haha! The examples/ folder might interest you, but for the music ones you'd still have to youtube-dl an audio file (which I include comment w/ command for). Much preferable to have test suite working out of the box, you are absolutely right...its only a few tests anyways so its unacceptable for it not to be working.

nateraw commented 1 year ago

hmm seems like I misunderstood the issue to begin with...thought you were talking about the test suite, but this is the test example from the readme. Checking

nateraw commented 1 year ago

Ok I investigated and was not able to replicate the issue on a clean python 3.9 environment on Ubuntu 20.04.

I created a new conda environment:

conda create -n py39-env python=3.9
conda activate py39-env

and ran setup/etc, then the code from your issue here that you got from the readme, and it worked just fine.