mazesmazes commited on
Commit
7eba4fb
·
verified ·
1 Parent(s): 0749de7

Update custom model files, README, and requirements

Browse files
Files changed (1) hide show
  1. asr_modeling.py +6 -0
asr_modeling.py CHANGED
@@ -619,10 +619,16 @@ class ASRModel(PreTrainedModel, GenerationMixin):
619
  # PEFT handles Hub downloads and caching internally
620
  from peft import PeftModel
621
 
 
 
 
 
 
622
  model.language_model = PeftModel.from_pretrained(
623
  model.language_model,
624
  pretrained_model_name_or_path,
625
  is_trainable=True,
 
626
  **cache_kwargs,
627
  )
628
  else:
 
619
  # PEFT handles Hub downloads and caching internally
620
  from peft import PeftModel
621
 
622
+ # Adapter weights load onto the base model's device. Left to
623
+ # PEFT they go straight to "cuda" whenever CUDA reports
624
+ # available, which ZeroGPU Spaces do at startup without a
625
+ # GPU attached ("No CUDA GPUs are available").
626
+ base_device = next(model.language_model.parameters()).device
627
  model.language_model = PeftModel.from_pretrained(
628
  model.language_model,
629
  pretrained_model_name_or_path,
630
  is_trainable=True,
631
+ torch_device=str(base_device),
632
  **cache_kwargs,
633
  )
634
  else: