LING commited on
Commit
f0349f3
·
1 Parent(s): b8e61a0

Fix device mismatch on ZeroGPU: update self.device inside @spaces.GPU.

Browse files
Files changed (1) hide show
  1. pipeline_ace_step.py +9 -0
pipeline_ace_step.py CHANGED
@@ -1491,6 +1491,15 @@ class ACEStepPipeline:
1491
 
1492
  start_time = time.time()
1493
 
 
 
 
 
 
 
 
 
 
1494
  if audio2audio_enable and ref_audio_input is not None:
1495
  task = "audio2audio"
1496
 
 
1491
 
1492
  start_time = time.time()
1493
 
1494
+ # ZeroGPU allocates a GPU only inside @spaces.GPU, so self.device
1495
+ # (set during __init__ without a GPU) is "cpu". Update it now.
1496
+ if self.device.type != "cuda" and torch.cuda.is_available():
1497
+ self.device = torch.device("cuda:0")
1498
+ if self.loaded:
1499
+ self.music_dcae.to(self.device)
1500
+ self.ace_step_transformer.to(self.device)
1501
+ self.text_encoder_model.to(self.device)
1502
+
1503
  if audio2audio_enable and ref_audio_input is not None:
1504
  task = "audio2audio"
1505