SEBIS{URGENT},ValueError: You have to specify either decoder_inputs or decoder_inputs_embeds

ValueError: You have to specify either decoder_inputs or decoder_inputs_embeds

Could somebody please help.

Hi @Rohit

It’s not clear what exactly you want to do. Could you please provide more information?

From what I can see, it’s a T5 model. If you want to use it for Seq2Seq generation then you should use the AutoModelForConditionalGeneration or T5ForConditionalGeneration class and use the generate method.

And in general the forward of any seq2seq models expects input_ids (input for encoder) and decoder_input_ids (input for decoder). T5Model throws this error when the decoder_input_ids are not provided.

2 Likes

Thanks a lot…Actually I m new to this so i didnt knew how to use it…i wanted to use it as seq2seq I followed your refernce and it worked… :grinning:

Hi @Rohit,

You could also set the pipeline like:

and use pipeline([code]) to generate description for the input code.
Here is one Colab example: https://github.com/agemagician/CodeTrans/blob/main/prediction/multitask/fine-tuning/function%20documentation%20generation/java/base_model.ipynb