I try to generate with the code:
model.generate(input_ids=None, inputs_embeds=student_embeddings, attention_mask=node_masks, num_beams=4, max_length=config[“max_seq_length”], early_stopping=True)
you can see my input_ids is None, but when I run this code system return error :
File “/home/amax/anaconda3/envs/shj_dev/lib/python3.9/site-packages/transformers/models/bart/modeling_bart.py”, line 740, in forward
raise ValueError(“You cannot specify both input_ids and inputs_embeds at the same time”)
ValueError: You cannot specify both input_ids and inputs_embeds at the same time
I try to read code and I found it in generation_utils.py
if input_ids is None:
# init input_ids with bos_token_id
input_ids = self._prepare_input_ids_for_generation(bos_token_id, model_kwargs.get(“encoder_outputs”))
this code will get a valve to input_ids, and then system return the error
You cannot specify both input_ids and inputs_embeds at the same time
How to fix it ?