Gamahea commited on
Commit
6c94d55
·
verified ·
1 Parent(s): e1e9d05

Enhanced error handling for ZeroGPU quota errors

Browse files
backend/services/diffrhythm_service.py CHANGED
@@ -288,7 +288,19 @@ class DiffRhythmService:
288
 
289
  except Exception as e:
290
  logger.error(f"Music generation failed: {str(e)}", exc_info=True)
291
- raise RuntimeError(f"Failed to generate music: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  @GPU_DECORATOR(duration=120)
294
  def _generate_with_diffrhythm2(
 
288
 
289
  except Exception as e:
290
  logger.error(f"Music generation failed: {str(e)}", exc_info=True)
291
+
292
+ # Provide more helpful error messages for common issues
293
+ error_str = str(e)
294
+ if "ZeroGPU quota" in error_str or "running out of daily" in error_str:
295
+ raise RuntimeError(
296
+ "ZeroGPU quota limit reached. Please:\n"
297
+ "1. Make sure you're logged into HuggingFace\n"
298
+ "2. Check your quota at https://huggingface.co/settings/billing\n"
299
+ "3. Consider duplicating this Space to your account for dedicated quota\n"
300
+ f"\nOriginal error: {error_str}"
301
+ )
302
+ else:
303
+ raise RuntimeError(f"Failed to generate music: {str(e)}")
304
 
305
  @GPU_DECORATOR(duration=120)
306
  def _generate_with_diffrhythm2(