Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
828155e
1
Parent(s):
0207836
Fix: Modal deprecation warning and HF authentication
Browse files
backend_modal/modal_runner.py
CHANGED
|
@@ -17,6 +17,7 @@ image = (
|
|
| 17 |
"accelerate==1.6.0",
|
| 18 |
"transformers==4.51.3",
|
| 19 |
"diffusers",
|
|
|
|
| 20 |
"tqdm",
|
| 21 |
"numpy",
|
| 22 |
"scipy",
|
|
@@ -41,15 +42,11 @@ app = modal.App(
|
|
| 41 |
|
| 42 |
@app.cls(gpu="T4", scaledown_window=300, secrets=[modal.Secret.from_name("hf-secret")])
|
| 43 |
class VibeVoiceModel:
|
| 44 |
-
def __init__(self
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
}
|
| 50 |
-
else:
|
| 51 |
-
self.model_paths = model_paths
|
| 52 |
-
|
| 53 |
self.device = "cuda"
|
| 54 |
self.inference_steps = 5
|
| 55 |
|
|
@@ -59,6 +56,18 @@ class VibeVoiceModel:
|
|
| 59 |
This method is run once when the container starts.
|
| 60 |
It downloads and loads all models onto the GPU.
|
| 61 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# Project-specific imports are moved here to run inside the container
|
| 63 |
from modular.modeling_vibevoice_inference import VibeVoiceForConditionalGenerationInference
|
| 64 |
from processor.vibevoice_processor import VibeVoiceProcessor
|
|
|
|
| 17 |
"accelerate==1.6.0",
|
| 18 |
"transformers==4.51.3",
|
| 19 |
"diffusers",
|
| 20 |
+
"huggingface_hub",
|
| 21 |
"tqdm",
|
| 22 |
"numpy",
|
| 23 |
"scipy",
|
|
|
|
| 42 |
|
| 43 |
@app.cls(gpu="T4", scaledown_window=300, secrets=[modal.Secret.from_name("hf-secret")])
|
| 44 |
class VibeVoiceModel:
|
| 45 |
+
def __init__(self):
|
| 46 |
+
self.model_paths = {
|
| 47 |
+
"VibeVoice-1.5B": "microsoft/VibeVoice-1.5B",
|
| 48 |
+
"VibeVoice-7B": "vibevoice/VibeVoice-7B",
|
| 49 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
self.device = "cuda"
|
| 51 |
self.inference_steps = 5
|
| 52 |
|
|
|
|
| 56 |
This method is run once when the container starts.
|
| 57 |
It downloads and loads all models onto the GPU.
|
| 58 |
"""
|
| 59 |
+
# Set up HuggingFace authentication
|
| 60 |
+
import os
|
| 61 |
+
from huggingface_hub import login
|
| 62 |
+
|
| 63 |
+
# Get the HF token from Modal secrets
|
| 64 |
+
hf_token = os.environ.get("HF_TOKEN")
|
| 65 |
+
if hf_token:
|
| 66 |
+
login(token=hf_token)
|
| 67 |
+
print("Logged in to HuggingFace Hub")
|
| 68 |
+
else:
|
| 69 |
+
print("Warning: No HF_TOKEN found in secrets")
|
| 70 |
+
|
| 71 |
# Project-specific imports are moved here to run inside the container
|
| 72 |
from modular.modeling_vibevoice_inference import VibeVoiceForConditionalGenerationInference
|
| 73 |
from processor.vibevoice_processor import VibeVoiceProcessor
|