Skip to content

LLM-IUT-services/summary-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

service overview ✨

Our service is designed to perform two core tasks Text Summarization and Question Answering. This document provides an overview of both features and how to use them effectively.

1. Text Summarization 📃

The service can generate concise and meaningful summaries of given text. This is useful for extracting key points from long documents, articles, or reports.

How It Works 🤔

  • Input : A passage.
  • Output : A short, coherent summary that captures the main ideas.

Use Cases

  • Summarizing news articles.
  • Condensing research papers.
  • Extracting key points from business reports.

2. Question Answering on Processed Text ❓

The service can answer questions based on a given text. This allows users to interact with the content more effectively.

How It Works 🤔

  • Input : A csv or exel format file.
  • Output : A precise answer derived from the given text.

Use Cases

  • Extracting specific details from a document.
  • Automating customer support queries.
  • Analyzing and interpreting content for research purposes.

How to Use the service 🔰🎯

i don't know yet 😅(complete next)


This service

is designed to improve efficiency in handling large volumes of text by simplifying content and providing accurate answers to relevant queries and can support both English and Persion language . if we want to be more deeper on the model we use can demonstrate on the sub models :
for english we use flan - T5 for both Summarization and Question Answering . if you want more detail about this model click on bellow collapsible section :

Click to expand

🧠 Flan-T5: An Overview

Flan-T5 (Fine-tuned Language Net T5) is an advanced version of Google's T5 (Text-To-Text Transfer Transformer) model, fine-tuned on instruction-following tasks to enhance its ability to understand and generate natural language.


🔍 Key Features

  • Instruction-Tuned: Trained on a diverse set of tasks to improve performance in real-world applications.
  • Text-to-Text Framework: Accepts input text and generates output text, making it highly flexible.
  • Multi-Task Learning: Excels in summarization, translation, question answering, and more.
  • Scalable Variants: Available in different sizes (small, base, large, XL, and XXL) to balance performance and efficiency.

🚀 How It Works

Flan-T5 follows the encoder-decoder (transformer) architecture:
1️⃣ Encoder: Processes the input text.
2️⃣ Decoder: Generates the output text based on learned patterns and instructions.

Unlike traditional models, Flan-T5 is pre-trained on a mixture of tasks before fine-tuning on instruction datasets, making it more adaptable to various applications.


🎯 Use Cases

Text Summarization – Compressing long articles into concise summaries.
Question Answering – Extracting or generating answers from given contexts.
Text Generation – Writing creative or informative content based on prompts.
Code Generation – Assisting in programming by generating code snippets.
Translation – Converting text between multiple languages.


📊 Variants & Model Sizes

Flan-T5 comes in several versions, offering a trade-off between speed and accuracy:

Model Variant Parameters Use Case
Flan-T5 Small ~80M Lightweight, suitable for simple tasks
Flan-T5 Base ~250M Balanced for general use
Flan-T5 Large ~780M Improved accuracy for complex tasks
Flan-T5 XL ~3B Stronger reasoning and comprehension
Flan-T5 XXL ~11B Best performance, requires more resources

⚙️ How to Use Flan-T5

You can use Flan-T5 via Hugging Face's Transformers library:

from transformers import T5Tokenizer, T5ForConditionalGeneration

# Load the model and tokenizer
model_name = "google/flan-t5-large"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)

# Define input text
input_text = "Summarize: The history of artificial intelligence is fascinating..."
inputs = tokenizer(input_text, return_tensors="pt")

# Generate output
output = model.generate(**inputs)
print(tokenizer.decode(output[0], skip_special_tokens=True))

and for Persian language for Summarization we use HooshvareLab/pn-summary-mt5-small if you want more detail about this model click on bellow collapsible section

Click to expand

📝 HooshvareLab/pn-summary-mt5-small: An Overview

The HooshvareLab/pn-summary-mt5-small is a Persian-focused text summarization model based on mT5-small, a multilingual version of Google's T5 (Text-To-Text Transfer Transformer). This model is fine-tuned specifically for Persian text summarization, making it highly effective for compressing Persian-language articles, news, and documents.


🔍 Key Features

  • 🌍 Multilingual T5 (mT5) Base: Built on mT5-small, which supports multiple languages.
  • 🏆 Persian-Specific Fine-Tuning: Trained on Persian-language datasets for accurate summaries.
  • 📝 Text-to-Text Format: Takes a Persian input text and generates a summarized version in Persian.
  • Lightweight & Efficient: Small model size for faster processing and deployment.

🚀 How It Works

Like T5, the HooshvareLab/pn-summary-mt5-small follows an encoder-decoder structure:
1️⃣ Encoder: Processes the input Persian text.
2️⃣ Decoder: Generates a summarized output in Persian.

This model has been fine-tuned using Persian summarization datasets, improving its accuracy and fluency in Persian-language content.


🎯 Use Cases

News Summarization – Condensing Persian news articles into key points.
Document Summarization – Extracting key information from lengthy Persian texts.
Content Simplification – Helping users understand Persian texts faster.
AI-Powered Persian NLP – Enhancing Persian text applications and research.


⚙️ How to Use the Model

You can use HooshvareLab/pn-summary-mt5-small via Hugging Face’s Transformers library:

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

# Load model and tokenizer
model_name = "HooshvareLab/pn-summary-mt5-small"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)

# Define Persian input text
persian_text = "متن بلند برای خلاصه‌سازی اینجا قرار می‌گیرد."
inputs = tokenizer("summarize: " + persian_text, return_tensors="pt", max_length=512, truncation=True)

# Generate summary
output = model.generate(**inputs, max_length=150, num_beams=5, early_stopping=True)
print(tokenizer.decode(output[0], skip_special_tokens=True))

and in Persian language for Question Answering we use mansoorhamidzadeh/parsbert-persian-QA if you want more detail about this model click on bellow collapsible section

Click to expand

❓ ParsBERT-Persian-QA: An Overview

The ParsBERT-Persian-QA model, developed by Mansoor Hamidzadeh, is a question-answering (QA) model fine-tuned on Persian texts. It is based on ParsBERT, a powerful Persian-language variant of BERT, optimized for extracting answers from Persian documents.


🔍 Key Features

  • 🇮🇷 Persian-Specific Training: Fine-tuned on Persian-language datasets for QA tasks.
  • 🏗 BERT-Based Architecture: Built on ParsBERT, a state-of-the-art Transformer-based Persian NLP model.
  • Extractive Question Answering: Finds precise answers within a given Persian text.
  • Efficient & Accurate: Designed for fast inference and high accuracy in Persian QA tasks.

🚀 How It Works

This model follows the extractive QA approach, meaning:
1️⃣ Input: A Persian passage + a Persian question.
2️⃣ Processing: The model analyzes the passage to find the most relevant answer.
3️⃣ Output: A specific part of the passage that answers the question.

It is trained on Persian QA datasets, ensuring accurate and fluent responses in Persian.


🎯 Use Cases

Automated Q&A Systems – Powering Persian chatbots and virtual assistants.
Document Search & Analysis – Extracting key answers from Persian texts.
Customer Support Automation – Answering FAQs in Persian.
Educational Tools – Helping students and researchers find information quickly.


⚙️ How to Use the Model

You can use ParsBERT-Persian-QA with Hugging Face's Transformers library:

from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline

# Load the model and tokenizer
model_name = "mansoorhamidzadeh/parsbert-persian-QA"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForQuestionAnswering.from_pretrained(model_name)

# Define Persian context and question
persian_context = "تهران پایتخت ایران است. این شهر بزرگ‌ترین شهر ایران محسوب می‌شود."
persian_question = "پایتخت ایران کجاست؟"

# Use Hugging Face pipeline for easy inference
qa_pipeline = pipeline("question-answering", model=model, tokenizer=tokenizer)
result = qa_pipeline(question=persian_question, context=persian_context)

# Print the answer
print("Answer:", result["answer"])


okay

About

This repo is inteded for a web app service that summarizes, reports events, etc.. based on the input you provide

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors