TinyNewsLlama-1.1B is a QLoRA SFT fine-tune of
TinyLlama/TinyLlama-1.1B-Chat-v1.0 using a sample of a concentrated version of the [bigNews] (
https://paperswithcode.com/dataset/bignews) Dataset. The model was fine-tuned for ~12h on one A100 40GB on ~125M tokens.
The goal of this project is to study the potential for improving the domain-specific (in this case political) knowledge of small (<3B) LLMs by concentrating the training datasets TF-IDF in respect to the underlying Topics found in the origianl Dataset.
1!pip install -qU transformers accelerate
2from transformers import AutoTokenizer
3import transformers
4import torch
5
6model = "h4rz3rk4s3/TinyNewsLlama-1.1B"
7messages = [
8 {
9 "role": "system",
10 "content": "You are a an experienced journalist.",
11 },
12 {"role": "user", "content": "Write a short article on Brexit and it's impact on the European Union."},
13]
14
15tokenizer = AutoTokenizer.from_pretrained(model)
16prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
17pipeline = transformers.pipeline(
18 "text-generation",
19 model=model,
20 device_map="auto",
21)
22outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
23print(outputs[0]["generated_text"])