freddyaboulton HF staff commited on
Commit
9fffe91
1 Parent(s): bac62d2

Move input_ids to cuda device

Browse files

The original code does not work on ZeroGPU

Files changed (1) hide show
  1. README.md +3 -2
README.md CHANGED
@@ -65,10 +65,11 @@ for message in conversation:
65
  )
66
 
67
  inputs = processor(text=text, audios=audios, return_tensors="pt", padding=True)
68
- inputs.input_ids = inputs.input_ids.to("cuda")
 
69
 
70
  generate_ids = model.generate(**inputs, max_length=256)
71
- generate_ids = generate_ids[:, inputs.input_ids.size(1):]
72
 
73
  response = processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
74
  ```
 
65
  )
66
 
67
  inputs = processor(text=text, audios=audios, return_tensors="pt", padding=True)
68
+ inputs = dict(**inputs)
69
+ inputs["input_ids"] = inputs["input_ids"].to("cuda")
70
 
71
  generate_ids = model.generate(**inputs, max_length=256)
72
+ generate_ids = generate_ids[:, inputs["input_ids"].size(1):]
73
 
74
  response = processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
75
  ```