kavyabhand commited on
Commit
82d85cb
·
verified ·
1 Parent(s): 5675884

Fix startup crash: ImportError (diffusers-export-api-drift)

Browse files

Hi! This Space currently fails to start on Hugging Face with:

```
ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/home/user/.pyenv/versions/3.10.15/lib/python3.10/site-packages/huggingface_hub/__init__.py)
```

**Cause.** The decisive runtime error is `ValueError: too many values to unpack (expected 3)` at `h, w, c = video_frames[0].shape` in `diffusers.utils.export_utils.export_to_video`. `pipe(...).frames` is batched as `(batch, frames, H, W, C)`, so `video_frames[0]` is 4D; the first batch must be selected before export. The build also fails on the unused `av<10.0.0` dependency, which tries to compile against missing libav headers.

**Change.** `README.md`, `requirements.txt`, `video_diffusion/damo/damo_text2_video.py`. `requirements.txt` is a lockfile resolved as of 2024-03-15 (Python 3.10), so the app runs on the library versions it was written for. `python_version` is pinned in the README to the interpreter we tested with. Nothing else is touched.

**Tested.** We rebuilt the Space with this patch the way Spaces builds it (README front-matter, `requirements.txt`, then the SDK), on an NVIDIA A10G (same GPU as a10g-small). The app started, and calling its `/generate_video_2` endpoint returned:

```
1 output file(s) (mp4), non-empty
```

The diagnosis and patch were written by [Beam](https://huggingface.co/reflection/Beam-1.0-501B-A23B) (Reflection AI's open model) as part of Space Doctor, a Build with Beam challenge project that repairs broken Spaces and only proposes fixes that pass this check. We read the diff before opening this PR. Feel free to close it if you'd rather fix it another way.

README.md CHANGED
@@ -1,4 +1,5 @@
1
  ---
 
2
  title: Video Diffusion WebUI
3
  emoji: 🏃
4
  colorFrom: gray
 
1
  ---
2
+ python_version: "3.10"
3
  title: Video Diffusion WebUI
4
  emoji: 🏃
5
  colorFrom: gray
requirements.txt CHANGED
@@ -1,12 +1,139 @@
1
- torch
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  diffusers==0.26.3
3
- transformers
4
- accelerate
5
- opencv-python
6
- realesrgan
7
- librosa
8
- xformers
9
- einops
10
- av<10.0.0
 
 
 
 
 
 
 
 
 
 
 
11
  imageio==2.9.0
12
- imageio-ffmpeg==0.4.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==2.1.0
2
+ accelerate==0.28.0
3
+ addict==2.4.0
4
+ aiofiles==23.2.1
5
+ altair==5.2.0
6
+ annotated-types==0.6.0
7
+ anyio==4.3.0
8
+ attrs==23.2.0
9
+ audioread==3.0.1
10
+ authlib==1.3.0
11
+ basicsr==1.4.2
12
+ certifi==2024.2.2
13
+ cffi==1.16.0
14
+ charset-normalizer==3.3.2
15
+ click==8.1.7
16
+ colorama==0.4.6
17
+ contourpy==1.2.0
18
+ cryptography==42.0.5
19
+ cycler==0.12.1
20
+ decorator==5.1.1
21
  diffusers==0.26.3
22
+ einops==0.7.0
23
+ exceptiongroup==1.2.0
24
+ facexlib==0.3.0
25
+ fastapi==0.110.0
26
+ ffmpy==0.3.2
27
+ filelock==3.13.1
28
+ filterpy==1.4.5
29
+ fonttools==4.50.0
30
+ fsspec==2024.3.0
31
+ future==1.0.0
32
+ gfpgan==1.3.8
33
+ gradio==4.19.0
34
+ gradio-client==0.10.0
35
+ grpcio==1.62.1
36
+ h11==0.14.0
37
+ httpcore==1.0.4
38
+ httpx==0.27.0
39
+ huggingface-hub==0.21.4
40
+ idna==3.6
41
  imageio==2.9.0
42
+ imageio-ffmpeg==0.4.2
43
+ importlib-metadata==7.0.2
44
+ importlib-resources==6.3.0
45
+ itsdangerous==2.1.2
46
+ jinja2==3.1.3
47
+ joblib==1.3.2
48
+ jsonschema==4.21.1
49
+ jsonschema-specifications==2023.12.1
50
+ kiwisolver==1.4.5
51
+ lazy-loader==0.3
52
+ librosa==0.10.1
53
+ llvmlite==0.42.0
54
+ lmdb==1.4.1
55
+ markdown==3.6
56
+ markdown-it-py==3.0.0
57
+ markupsafe==2.1.5
58
+ matplotlib==3.8.3
59
+ mdurl==0.1.2
60
+ mpmath==1.3.0
61
+ msgpack==1.0.8
62
+ networkx==3.2.1
63
+ numba==0.59.0
64
+ numpy==1.26.4
65
+ nvidia-cublas-cu12==12.1.3.1
66
+ nvidia-cuda-cupti-cu12==12.1.105
67
+ nvidia-cuda-nvrtc-cu12==12.1.105
68
+ nvidia-cuda-runtime-cu12==12.1.105
69
+ nvidia-cudnn-cu12==8.9.2.26
70
+ nvidia-cufft-cu12==11.0.2.54
71
+ nvidia-curand-cu12==10.3.2.106
72
+ nvidia-cusolver-cu12==11.4.5.107
73
+ nvidia-cusparse-cu12==12.1.0.106
74
+ nvidia-nccl-cu12==2.19.3
75
+ nvidia-nvjitlink-cu12==12.4.99
76
+ nvidia-nvtx-cu12==12.1.105
77
+ opencv-python==4.9.0.80
78
+ orjson==3.9.15
79
+ packaging==24.0
80
+ pandas==2.2.1
81
+ pillow==10.2.0
82
+ platformdirs==4.2.0
83
+ pooch==1.8.1
84
+ protobuf==5.26.0
85
+ psutil==5.9.8
86
+ pycparser==2.21
87
+ pydantic==2.6.4
88
+ pydantic-core==2.16.3
89
+ pydub==0.25.1
90
+ pygments==2.17.2
91
+ pyparsing==3.1.2
92
+ python-dateutil==2.9.0.post0
93
+ python-multipart==0.0.9
94
+ pytz==2024.1
95
+ pywavelets==1.5.0
96
+ pyyaml==6.0.1
97
+ realesrgan==0.3.0
98
+ referencing==0.33.0
99
+ regex==2023.12.25
100
+ requests==2.31.0
101
+ rich==13.7.1
102
+ rpds-py==0.18.0
103
+ ruff==0.3.3
104
+ safetensors==0.4.2
105
+ scikit-image==0.20.0
106
+ scikit-learn==1.4.1.post1
107
+ scipy==1.12.0
108
+ semantic-version==2.10.0
109
+ setuptools==69.2.0
110
+ shellingham==1.5.4
111
+ six==1.16.0
112
+ sniffio==1.3.1
113
+ soundfile==0.12.1
114
+ soxr==0.3.7
115
+ starlette==0.36.3
116
+ sympy==1.12
117
+ tb-nightly==2.17.0a20240315
118
+ tensorboard-data-server==0.7.2
119
+ threadpoolctl==3.3.0
120
+ tifffile==2024.2.12
121
+ tokenizers==0.15.2
122
+ tomli==2.0.1
123
+ tomlkit==0.12.0
124
+ toolz==0.12.1
125
+ torch==2.2.1
126
+ torchvision==0.17.1
127
+ tqdm==4.66.2
128
+ transformers==4.38.2
129
+ triton==2.2.0
130
+ typer==0.9.0
131
+ typing-extensions==4.10.0
132
+ tzdata==2024.1
133
+ urllib3==2.2.1
134
+ uvicorn==0.28.0
135
+ websockets==11.0.3
136
+ werkzeug==3.0.1
137
+ xformers==0.0.25
138
+ yapf==0.40.2
139
+ zipp==3.18.1
video_diffusion/damo/damo_text2_video.py CHANGED
@@ -42,7 +42,7 @@ class DamoText2VideoGenerator:
42
  width=width,
43
  num_inference_steps=num_inference_steps,
44
  guidance_scale=guidance_scale,
45
- ).frames
46
 
47
  video_path = export_to_video(video)
48
  return video_path
 
42
  width=width,
43
  num_inference_steps=num_inference_steps,
44
  guidance_scale=guidance_scale,
45
+ ).frames[0]
46
 
47
  video_path = export_to_video(video)
48
  return video_path