gabrielmbmb HF staff commited on
Commit
89047a4
1 Parent(s): 97bc38d

Update modeling_custom.py

Browse files
Files changed (1) hide show
  1. modeling_custom.py +1 -1
modeling_custom.py CHANGED
@@ -140,7 +140,7 @@ class LlamaForRewardModelWithGating(LlamaPreTrainedModel):
140
  # if no pad token found, use modulo instead of reverse indexing for ONNX compatibility
141
  sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
142
  sequence_lengths = sequence_lengths % input_ids.shape[-1]
143
- sequence_lengths = sequence_lengths.to(tokens_hidden_states.device)
144
  else:
145
  sequence_lengths = -1
146
 
 
140
  # if no pad token found, use modulo instead of reverse indexing for ONNX compatibility
141
  sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
142
  sequence_lengths = sequence_lengths % input_ids.shape[-1]
143
+ sequence_lengths = sequence_lengths.to("cuda")
144
  else:
145
  sequence_lengths = -1
146