Sergidev commited on
Commit
9e8ad33
·
1 Parent(s): 59611ef
Files changed (2) hide show
  1. requirements.txt +44 -7
  2. utils.py +36 -5
requirements.txt CHANGED
@@ -1,11 +1,48 @@
1
  --extra-index-url https://download.pytorch.org/whl/cu124
2
- git+https://github.com/huggingface/diffusers.git@main
3
- git+https://github.com/huggingface/transformers.git@main
4
- torch>=2.4.0,<2.6.0
5
- gradio>=4.0.0
6
- safetensors
 
 
 
 
 
 
7
  huggingface_hub
8
  imageio
9
- opencv-python-headless
10
- Pillow>=10.2.0
 
 
 
11
  numpy<2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  --extra-index-url https://download.pytorch.org/whl/cu124
2
+ bitsandbytes
3
+ decord
4
+ einops
5
+ facexlib
6
+ ftfy
7
+ gguf
8
+ git+https://github.com/huggingface/accelerate.git@main#egg=accelerate
9
+ git+https://github.com/huggingface/diffusers.git@main#egg=diffusers
10
+ git+https://github.com/huggingface/transformers.git@main#egg=transformers
11
+ gradio
12
+ hf_transfer
13
  huggingface_hub
14
  imageio
15
+ imageio-ffmpeg
16
+ insightface
17
+ invisible_watermark
18
+ matplotlib
19
+ moviepy==1.0.3
20
  numpy<2.0
21
+ onnxruntime
22
+ onnxruntime-gpu
23
+ omegaconf
24
+ opencv-python
25
+ opencv-python-headless
26
+ git+https://github.com/huggingface/optimum-quanto
27
+ packaging
28
+ patch_conv
29
+ Pillow==10.2.0
30
+ psutil
31
+ safetensors
32
+ scipy
33
+ scikit-learn
34
+ scikit-image
35
+ scikit-video
36
+ sentencepiece
37
+ setuptools
38
+ spaces
39
+ timm
40
+ tokenizers>=0.13.3
41
+ torch<2.6.0,>=2.4.0
42
+ torchao
43
+ torchaudio
44
+ torchsde
45
+ torchvision
46
+ tqdm
47
+ wheel
48
+ git+https://github.com/huggingface/peft.git
utils.py CHANGED
@@ -1,9 +1,40 @@
1
  def install_packages():
2
  import subprocess
3
  import sys
 
4
 
5
- subprocess.run([
6
- sys.executable, "-m", "pip", "install",
7
- "-r", "requirements.txt",
8
- "--upgrade"
9
- ], check=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  def install_packages():
2
  import subprocess
3
  import sys
4
+ import importlib
5
 
6
+ def _is_package_available(name) -> bool:
7
+ try:
8
+ importlib.import_module(name)
9
+ return True
10
+ except (ImportError, ModuleNotFoundError):
11
+ return False
12
+
13
+ # upgrade pip
14
+ subprocess.run(
15
+ f"{sys.executable} -m pip install --upgrade pip", shell=True, check=True
16
+ )
17
+ subprocess.run(
18
+ f"{sys.executable} -m pip install --upgrade ninja wheel setuptools packaging", shell=True, check=True
19
+ )
20
+
21
+ # install ninja
22
+ if not _is_package_available("ninja"):
23
+ subprocess.run(f"{sys.executable} -m pip install ninja nvidia-cudnn-cu12==9.1.0.70 nvidia-cublas-cu12==12.4.5.8 torch==2.5.1 --extra-index-url https://download.pytorch.org/whl/cu124", shell=True, check=True)
24
+
25
+ # install flash attention
26
+ if not _is_package_available("flash_attn"):
27
+ subprocess.run(
28
+ f"{sys.executable} -m pip install -v -U flash-attention --no-build-isolation",
29
+ env={"MAX_JOBS": "1"},
30
+ shell=True,
31
+ check=True
32
+ )
33
+
34
+ # install xformers
35
+ if not _is_package_available("xformers"):
36
+ subprocess.run(
37
+ f"{sys.executable} -m pip install -v -U xformers nvidia-cudnn-cu12==9.1.0.70 nvidia-cublas-cu12==12.4.5.8 torch==2.5.1 --extra-index-url https://download.pytorch.org/whl/cu124",
38
+ shell=True,
39
+ check=True
40
+ )