Regarding generate method used in BART
# ❓ Questions & Help

<!-- The GitHub issue tracker is primarily intended for bugs, feature requests,
     new models and benchmarks, and migration questions. For all other questions,
     we direct you to Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiasts can help you out. Make sure to tag your question with the
     right deep learning framework as well as the huggingface-transformers tag: 
     https://stackoverflow.com/questions/tagged/huggingface-transformers 
     
     If your question wasn't answered after a period of time on Stack Overflow, you can always open a question on GitHub. You should then link to the SO question that you posted.
     -->

## Details
<!-- Description of your issue -->

<!-- You should first ask your question on SO, and only if you didn't get an answer ask it here on GitHub. -->

I am new to NLP and text generation so please help me understand some basic things.
I fine-tuned BART on CNN/DM dataset using provide scripts in the examples section and it works fine.
I have some understanding of how model.generate() method works. But need to clarify some basic questions.
Is the generate() method used at the time of training/validation?
If yes, then how loss is computed if the beam size is greater than 1?
Or do we even use the parameters like in generate() method during training?

Please help. Thank you.

Hey @kunalpagarey, 

The `.generate()` method cannot be used for training. It can be used for validation and testing. 
To create a good model for summarization the following components are important:

**Train**:
1. What model do you want to use? => Bart for example
2. What loss function do you want to use? => Usually people do pretraining and then finetuning on summarization using standard maximum likelihood. For some detail on how to fine-tune Bart with `transformers` check out: https://github.com/ohmeow/ohmeow_website/blob/master/_notebooks/2020-05-23-text-generation-with-blurr.ipynb

** Decoding method** 
After having fine-tuned a model on summarization, the decoding method to apply is another whole question and is often done independently of training. Now, you can decide how to use the `generate()` method. You could for example try out a bunch of different hyperparameters for `.generate()` on your validation set and then decide on one setting for want to use for your test set. 
For more details on how to choose hyperparameters for `.generate()` check out: 
https://huggingface.co/blog/how-to-generate

