Gamahea commited on
Commit
990bc24
·
1 Parent(s): 0170ae2

Completely disable pin_memory and num_workers for ZeroGPU compatibility

Browse files

- Set pin_memory=False (ZeroGPU doesn't provide persistent CUDA access)
- Set num_workers=0 (multiprocessing doesn't work well with ZeroGPU)
- Previous fix checked cuda.is_available() but ZeroGPU returns True without actual access
- This ensures compatibility with both CPU and ZeroGPU environments

backend/services/lora_training_service.py CHANGED
@@ -303,23 +303,22 @@ class LoRATrainingService:
303
  )
304
 
305
  # Create data loaders
306
- # Only use pin_memory if CUDA is actually available
307
- use_pin_memory = torch.cuda.is_available()
308
-
309
  train_loader = DataLoader(
310
  train_dataset,
311
  batch_size=self.training_config['batch_size'],
312
  shuffle=True,
313
- num_workers=2,
314
- pin_memory=use_pin_memory
315
  )
316
 
317
  val_loader = DataLoader(
318
  val_dataset,
319
  batch_size=self.training_config['batch_size'],
320
  shuffle=False,
321
- num_workers=2,
322
- pin_memory=use_pin_memory
323
  )
324
 
325
  # Initialize model (placeholder - actual implementation would load DiffRhythm2)
 
303
  )
304
 
305
  # Create data loaders
306
+ # Disable pin_memory and num_workers for compatibility with ZeroGPU and CPU
307
+ # pin_memory requires persistent CUDA access which ZeroGPU doesn't provide at this stage
 
308
  train_loader = DataLoader(
309
  train_dataset,
310
  batch_size=self.training_config['batch_size'],
311
  shuffle=True,
312
+ num_workers=0,
313
+ pin_memory=False
314
  )
315
 
316
  val_loader = DataLoader(
317
  val_dataset,
318
  batch_size=self.training_config['batch_size'],
319
  shuffle=False,
320
+ num_workers=0,
321
+ pin_memory=False
322
  )
323
 
324
  # Initialize model (placeholder - actual implementation would load DiffRhythm2)