Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -19,8 +19,9 @@ def get_or_load_model():
|
|
19 |
if MODEL is None:
|
20 |
print("Model not loaded, initializing...")
|
21 |
try:
|
22 |
-
#
|
23 |
-
|
|
|
24 |
if hasattr(MODEL, 'to') and str(getattr(MODEL, 'device', 'cpu')) != DEVICE:
|
25 |
MODEL.to(DEVICE)
|
26 |
print(f"Model loaded successfully. Internal device: {getattr(MODEL, 'device', 'N/A')}")
|
|
|
19 |
if MODEL is None:
|
20 |
print("Model not loaded, initializing...")
|
21 |
try:
|
22 |
+
# Correctly load the model by passing 'device' as a keyword argument.
|
23 |
+
# This ensures the model's tensors are mapped to the CPU during loading.
|
24 |
+
MODEL = ChatterboxTTS.from_pretrained(device=DEVICE)
|
25 |
if hasattr(MODEL, 'to') and str(getattr(MODEL, 'device', 'cpu')) != DEVICE:
|
26 |
MODEL.to(DEVICE)
|
27 |
print(f"Model loaded successfully. Internal device: {getattr(MODEL, 'device', 'N/A')}")
|