Views
No views yet
1# Install transformers library
2!pip install transformers1# Load tokenizer and model
2from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, TFAutoModelForSeq2SeqLM
3model_name = "Seungjun/articleGeneratorV1.0"
4tokenizer = AutoTokenizer.from_pretrained("t5-small")
5model = TFAutoModelForSeq2SeqLM.from_pretrained(model_name)1# Get the article for a given title
2from transformers import pipeline
3summarizer = pipeline("summarization", model=model, tokenizer=tokenizer, framework="tf")
4summarizer(
5 "Steve Jobs", # title
6 min_length=500,
7 max_length=1024,
8)| Train Loss | Validation Loss | Train Rougel | Epoch |
|---|---|---|---|
| 4.9218 | 4.0315 | tf.Tensor(0.08038119, shape=(), dtype=float32) | 0 |
| 4.2887 | 3.8366 | tf.Tensor(0.08103053, shape=(), dtype=float32) | 1 |
| 4.1269 | 3.7328 | tf.Tensor(0.081041485, shape=(), dtype=float32) | 2 |
| 4.0276 | 3.6614 | tf.Tensor(0.081364945, shape=(), dtype=float32) | 3 |
| 3.9568 | 3.6096 | tf.Tensor(0.08172019, shape=(), dtype=float32) | 4 |