Summarization
Transformers
Safetensors
English
qwen2
text-generation
axolotl
text-generation-inference
Instructions to use thepowerfuldeez/Qwen2-1.5B-Summarize with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thepowerfuldeez/Qwen2-1.5B-Summarize with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "summarization" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("summarization", model="thepowerfuldeez/Qwen2-1.5B-Summarize")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("thepowerfuldeez/Qwen2-1.5B-Summarize") model = AutoModelForCausalLM.from_pretrained("thepowerfuldeez/Qwen2-1.5B-Summarize", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Qwen2-1.5B-Instruct finetuned on my own synthetic data for summarization task for 2 epochs
More info on the project at my github: https://github.com/thepowerfuldeez/qwen2_1_5b_summarize
Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-1.5B-Instruct")
model = AutoModelForCausalLM.from_pretrained("thepowerfuldeez/Qwen2-1.5B-Summarize",
bnb_4bit_compute_dtype=torch.bfloat16,
load_in_4bit=True, attn_implementation="flash_attention_2")
text = <YOUR_TEXT>
messages = [
{"role": "system", "content": "You are helpful AI assistant."},
{"role": "user", "content": f"Summarize following text: \n{text}"},
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors='pt')
new_tokens = model.generate(input_ids, max_new_tokens=1024)[0][len(input_ids[0]):]
summary = tokenizer.decode(new_tokens, skip_special_tokens=True)
Dataset
Train split is here
Metrics
BERTScore
| Model name | Dataset size | Result |
|---|---|---|
| Qwen2-1.5B-Instruct | - | 0.07 |
| Qwen2-1.5B-Summarize | 8000 | 0.14 |
| Qwen2-1.5B-Summarize | 20500 | In progress |
I have used BERTScore from official implementation with microsoft/deberta-xlarge-mnli model.
Then I sampled 32 inputs from test set (longer sentences to summarize) and generated summaries. I have reference summaries generated from stronger, Qwen2-72B-Instruct model, which I used as targets for metric.
- Downloads last month
- 11