You can maintain the diversity in samples by using techniques like:
- Temperature scaling
- Diversity-prompting loss
You can refer to the code showing these techniques:
\
In the above code generates diverse outputs by using temperature scaling and penalizing similarities between consecutive samples.