Spaces:
Running on Zero
Running on Zero
ACE-Step Custom commited on
Commit ·
180e887
1
Parent(s): 897bbd6
Force traditional loading: low_cpu_mem_usage=False + explicit device move
Browse files- acestep/handler.py +17 -16
acestep/handler.py
CHANGED
|
@@ -487,23 +487,24 @@ class AceStepHandler:
|
|
| 487 |
last_attn_error = None
|
| 488 |
self.model = None
|
| 489 |
|
| 490 |
-
#
|
| 491 |
# ACE-Step's ResidualFSQ performs tensor assertions during __init__ that fail on meta device
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
|
|
|
| 507 |
|
| 508 |
if self.model is None:
|
| 509 |
raise RuntimeError(
|
|
|
|
| 487 |
last_attn_error = None
|
| 488 |
self.model = None
|
| 489 |
|
| 490 |
+
# Force traditional loading to avoid meta device initialization
|
| 491 |
# ACE-Step's ResidualFSQ performs tensor assertions during __init__ that fail on meta device
|
| 492 |
+
for candidate in attn_candidates:
|
| 493 |
+
try:
|
| 494 |
+
logger.info(f"[initialize_service] Attempting to load model with attention implementation: {candidate}")
|
| 495 |
+
self.model = AutoModel.from_pretrained(
|
| 496 |
+
acestep_v15_checkpoint_path,
|
| 497 |
+
trust_remote_code=True,
|
| 498 |
+
attn_implementation=candidate,
|
| 499 |
+
torch_dtype=torch.bfloat16,
|
| 500 |
+
low_cpu_mem_usage=False, # Disable meta device
|
| 501 |
+
device_map=None # No automatic device mapping
|
| 502 |
+
).to(self.device) # Explicitly move to target device after load
|
| 503 |
+
attn_implementation = candidate
|
| 504 |
+
break
|
| 505 |
+
except Exception as e:
|
| 506 |
+
last_attn_error = e
|
| 507 |
+
logger.warning(f"[initialize_service] Failed to load model with {candidate}: {e}")
|
| 508 |
|
| 509 |
if self.model is None:
|
| 510 |
raise RuntimeError(
|