Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "ncls-p/Qwen2.5-3B-blog-key-points"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(model_id)
6
7article = """
8[Your article text here]
9"""
10
11prompt = f"""
12Extract the key points from the following article:
13
14{article}
15"""
16
17inputs = tokenizer(prompt, return_tensors="pt")
18outputs = model.generate(**inputs, max_length=1024)
19response = tokenizer.decode(outputs[0], skip_special_tokens=True)
20
21print(response)1{
2 "instruction": "",
3 "input": "Full article content",
4 "output": "Here are the key points of the article:\n* Key point 1\n* Key point 2\n* Key point 3\n..."
5}1@misc{qwen25-3b-blog-key-points,
2 author = {ncls-p},
3 title = {Qwen2.5-3B-blog-key-points},
4 year = {2024},
5 publisher = {Hugging Face},
6 journal = {Hugging Face model repository},
7 howpublished = {\url{https://huggingface.co/ncls-p/Qwen2.5-3B-blog-key-points}},
8}