multimodalart HF Staff commited on
Commit
96ad406
·
verified ·
1 Parent(s): 637b667

[Admin maintenance] Support new ZeroGPU hardware

Browse files

Thank you so much for having shared this Space with the community on this demo. We have upgraded the ZeroGPU infra-structure to run on modern blackwell architecture.
For that, we need to upgrade your demo to support that. This PR fixes your demo to work with the new architecture. As this is something we broke on our end, we may merge this PR autonomously. If this breaks unexpectedly or brings unintended consequences, feel free to revert, modify or otherwise. Any issues you can email apolinario@huggingface.co

Files changed (3) hide show
  1. README.md +3 -2
  2. app.py +19 -8
  3. requirements.txt +4 -5
README.md CHANGED
@@ -4,7 +4,8 @@ emoji: 🪄
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 4.44.1
 
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
@@ -13,4 +14,4 @@ models:
13
  - ali-vilab/ACE_Plus
14
  ---
15
 
16
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 5.49.1
8
+ python_version: "3.12"
9
  app_file: app.py
10
  pinned: false
11
  license: apache-2.0
 
14
  - ali-vilab/ACE_Plus
15
  ---
16
 
17
+ An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
app.py CHANGED
@@ -2,21 +2,32 @@
2
  # Copyright (c) Alibaba, Inc. and its affiliates.
3
  import threading
4
  import time
5
- import gradio as gr
6
- import numpy as np
7
- import spaces
8
- import torch
9
- from PIL import Image
10
  import glob
11
  import os, csv, sys
12
  import shlex
13
  import subprocess
14
  import importlib
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  subprocess.run("rm -rf /data-nvme/zerogpu-offload/*", env={}, shell=True)
16
  subprocess.run(shlex.split('pip install scepter --no-deps'))
17
- subprocess.run(shlex.split('pip install numpy==1.26'))
18
- subprocess.run(shlex.split('pip install flash-attn --no-build-isolation'),
19
- env=os.environ | {'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"})
 
 
 
20
  from scepter.modules.transform.io import pillow_convert
21
  from scepter.modules.utils.config import Config
22
  from scepter.modules.utils.distribute import we
 
2
  # Copyright (c) Alibaba, Inc. and its affiliates.
3
  import threading
4
  import time
 
 
 
 
 
5
  import glob
6
  import os, csv, sys
7
  import shlex
8
  import subprocess
9
  import importlib
10
+
11
+ # Python 3.12 removed `importlib.find_loader`; scepter still calls it. Shim it
12
+ # back via `importlib.util.find_spec` so the scepter import chain succeeds.
13
+ if not hasattr(importlib, "find_loader"):
14
+ import importlib.util
15
+ def _find_loader(name, path=None):
16
+ try:
17
+ spec = importlib.util.find_spec(name)
18
+ except (ImportError, ValueError):
19
+ return None
20
+ return spec.loader if spec is not None else None
21
+ importlib.find_loader = _find_loader
22
+
23
  subprocess.run("rm -rf /data-nvme/zerogpu-offload/*", env={}, shell=True)
24
  subprocess.run(shlex.split('pip install scepter --no-deps'))
25
+
26
+ import gradio as gr
27
+ import numpy as np
28
+ import spaces
29
+ import torch
30
+ from PIL import Image
31
  from scepter.modules.transform.io import pillow_convert
32
  from scepter.modules.utils.config import Config
33
  from scepter.modules.utils.distribute import we
requirements.txt CHANGED
@@ -2,10 +2,8 @@ huggingface_hub
2
  diffusers
3
  transformers==4.49.0
4
  gradio_imageslider
5
- torch==2.4.0
6
- xformers==0.0.27.post2
7
- torchvision
8
- gradio==4.44.1
9
  opencv-python==4.10.0.84
10
  albumentations
11
  beautifulsoup4
@@ -23,4 +21,5 @@ scikit-learn
23
  sentencepiece
24
  tiktoken
25
  torchsde
26
- transformers-stream-generator
 
 
2
  diffusers
3
  transformers==4.49.0
4
  gradio_imageslider
5
+ torch==2.10.0
6
+ torchvision==0.25.0
 
 
7
  opencv-python==4.10.0.84
8
  albumentations
9
  beautifulsoup4
 
21
  sentencepiece
22
  tiktoken
23
  torchsde
24
+ transformers-stream-generator
25
+ https://github.com/Dao-AILab/flash-attention/releases/download/v2.8.1/flash_attn-2.8.1+cu12torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl