Your team has a requirement to build a application feature to summarize documents. Team agreed to build it with Generative AI - Summarization Task. Your manager has asked you to suggest a few models for the team to try out. Your task:
In this exercise you will be carrying out a POC. Then you will use the results to make a recommendation. Exercise is the POC :) there are 2 parts in it.
(Optional) Share your results with others in the Q&A :)
text = """Fueling your body with a healthy diet isn't just about looking good, it's about building a vibrant
foundation for a life well-lived. Imagine a symphony of vibrant vegetables, a chorus of juicy fruits, and a
rhythm of whole grains and lean protein – that's the melody of a healthy diet,
nourishing your cells and empowering your spirit. Ditch the processed sirens and sugary temptations,
and embrace the natural orchestra of flavors and textures that nature offers. Let leafy greens be
your verdant bassline, their antioxidants dancing on your tongue. Citrus fruits, like sunshine-
kissed trumpets, add a bright, refreshing melody. Whole grains, the sturdy timpani, provide
sustained energy, while lean protein, a soulful cello, builds and repairs your body's instruments.
Don't forget the playful percussion of nuts and seeds, bursting with essential nutrients, and the
creamy, comforting oboe of legumes, rich in fiber and protein. This symphony of flavors isn't just
delicious, it's a powerful conductor, harmonizing your gut, boosting your immunity, and keeping your
energy levels soaring. So, ditch the culinary cacophony of processed foods, and embrace the healthy
concerto of a vibrant, colorful diet. Let your body be the maestro, conducting a symphony of well-
being, one delicious bite at a time."""
Note: If you are running on Google Colab:
Additional libraries
facebook/bart-large-cnn. Pre-trained model, fine tuned for comprehension. It has 406M parameters.
Falconsai/text_summarization is a Hugging Face fine-tuned model for text summarization. It has 60.5M parameters.
Other alternatives:
google/flan-t5-small. Model is good on multiple tasks. It has 77M parameters.
pip install transformers torch huggingface_hub