Sampling with FSMTForConditionalGeneration

Hi, I’m looking to perform some English to German translation using FSMTForConditionalGeneration model (loading pretrained model from facebook/wmt19-en-de). The current documentation only mentions decoding using beam search, but I was wondering if it’s also possible to perform sampling for decoding? I read the blog post here https://huggingface.co/blog/how-to-generate and it talks about sampling-based decoding with the generate method. But I wasn’t sure if the same is possible with FSMTForConditionalGeneration model. Can I also pass do_sample=True and temperature=<value> to FSMTForConditionalGeneration's generate method to perform sampling with specific temperature?

Yes, generate method is common for all generative models so you can do sampling with FSMT as well.

1 Like