Làm việc với Hugging Face
Jacob H. Marquez
Lead Data Engineer
$$

$$

$$
Trích xuất:
$$ ✅ Chọn câu quan trọng từ văn bản
$$ ✅ Hiệu quả, ít tài nguyên hơn
$$ ❌ Kém linh hoạt; có thể kém mạch lạc
$$
Trừu tượng:
$$ ✅ Tạo văn bản mới, diễn đạt lại
$$ ✅ Rõ ràng, dễ đọc hơn
$$ ❌ Cần nhiều tài nguyên và xử lý hơn
$$
$$
$$
$$




$$
$$
$$ $$
from transformers import pipeline
# Load the extractive summarization pipeline
summarizer = pipeline("summarization", model="nyamuda/extractive-summarization")
text = "This is my really large text about Data Science..."
summary_text = summarizer(text)
print(summary_text[0]['summary_text'])
"data science is a field that combines mathematics, statistics...."
from transformers import pipeline # Load the abstractive summarization pipeline summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")text = "This is my really large text about Data Science..." summary_text = summarizer(text) print(summary_text[0]['summary_text'])
"The global data science platform market is projected
is projected to reach $140.9 billion by 2025..."
min_new_tokens & max_new_tokens: Kiểm soát độ dài bản tóm tắtsummarizer = pipeline(task="summarization", min_new_tokens=10, max_new_tokens=150)
Làm việc với Hugging Face