multimodalart HF Staff commited on
Commit
bb16670
·
verified ·
1 Parent(s): 989544b

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -41,7 +41,9 @@ processor = AudioFlamingo3TemporalProcessor.from_pretrained(BASE_MODEL)
41
  model = AudioFlamingo3ForTemporalConditionalGeneration.from_pretrained(
42
  BASE_MODEL, dtype=torch.bfloat16, attn_implementation="sdpa"
43
  )
44
- model = PeftModel.from_pretrained(model, ADAPTER).merge_and_unload()
 
 
45
  model = model.eval().to("cuda")
46
 
47
  # ------------------------------------------------------------- utilities -----
 
41
  model = AudioFlamingo3ForTemporalConditionalGeneration.from_pretrained(
42
  BASE_MODEL, dtype=torch.bfloat16, attn_implementation="sdpa"
43
  )
44
+ # `torch_device="cpu"`: peft otherwise infers "cuda" and safetensors would try to
45
+ # materialise the adapter on a GPU that does not exist yet under ZeroGPU.
46
+ model = PeftModel.from_pretrained(model, ADAPTER, torch_device="cpu").merge_and_unload()
47
  model = model.eval().to("cuda")
48
 
49
  # ------------------------------------------------------------- utilities -----