Commit ·
d53b02e
1
Parent(s): 9d9a9ac
[Admin maintenance] Support new ZeroGPU hardware (#4)
Browse files- [Admin maintenance] Support new ZeroGPU hardware (87d804d2877c1779bc018273e47aeea4e2dad199)
- app.py +17 -1
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import spaces
|
| 2 |
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
| 3 |
-
from transformers.utils import is_flash_attn_2_available
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
from transformers.pipelines.audio_utils import ffmpeg_read
|
| 5 |
import torch
|
| 6 |
import gradio as gr
|
|
|
|
| 1 |
+
# Compat shim: gradio<=4.x imports HfFolder from huggingface_hub, removed in newer hub.
|
| 2 |
+
# Must run BEFORE `import spaces` (which transitively imports gradio).
|
| 3 |
+
import huggingface_hub
|
| 4 |
+
if not hasattr(huggingface_hub, "HfFolder"):
|
| 5 |
+
class HfFolder:
|
| 6 |
+
@staticmethod
|
| 7 |
+
def get_token():
|
| 8 |
+
return huggingface_hub.get_token()
|
| 9 |
+
huggingface_hub.HfFolder = HfFolder
|
| 10 |
+
|
| 11 |
import spaces
|
| 12 |
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
| 13 |
+
from transformers.utils import is_flash_attn_2_available
|
| 14 |
+
try:
|
| 15 |
+
# Removed from transformers.utils in newer releases; SDPA is available by default there.
|
| 16 |
+
from transformers.utils import is_torch_sdpa_available
|
| 17 |
+
except ImportError:
|
| 18 |
+
def is_torch_sdpa_available():
|
| 19 |
+
return True
|
| 20 |
from transformers.pipelines.audio_utils import ffmpeg_read
|
| 21 |
import torch
|
| 22 |
import gradio as gr
|
requirements.txt
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
transformers
|
| 2 |
-
accelerate
|
|
|
|
|
|
| 1 |
transformers
|
| 2 |
+
accelerate
|
| 3 |
+
python-multipart==0.0.12
|