czczup commited on
Commit
50b4a2c
1 Parent(s): a3a6b90

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. modeling_phi3.py +1 -1
modeling_phi3.py CHANGED
@@ -1370,7 +1370,7 @@ class Phi3ForCausalLM(Phi3PreTrainedModel):
1370
  position_ids = position_ids[:, -input_ids.shape[1] :]
1371
 
1372
  # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1373
- if inputs_embeds is not None and past_key_values is None:
1374
  model_inputs = {'inputs_embeds': inputs_embeds}
1375
  else:
1376
  model_inputs = {'input_ids': input_ids}
 
1370
  position_ids = position_ids[:, -input_ids.shape[1] :]
1371
 
1372
  # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1373
+ if (inputs_embeds is not None and past_key_values is None) or (inputs_embeds is not None and len(past_key_values) == 0):
1374
  model_inputs = {'inputs_embeds': inputs_embeds}
1375
  else:
1376
  model_inputs = {'input_ids': input_ids}