An error with BART model generate
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 forwardraise 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 timeI try to read code and I found it in generation_utils.pyif input_ids is None:# initinput_idswith bos_token_idinput_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 errorYou cannot specify both input_ids and inputs_embeds at the same timeHow to fix it ?
2021-10-13T07:36:02Z
It seems a bug ?
2021-10-13T08:34:44Z
The.generate()method does not currently supportinputs_embeds. One needs to provide input_ids to it in order to let it generate text.
2021-11-01T10:34:09Z
HI If I want to use my embedding, what should I do?