Views
No views yet
| Model | BLEU | BERTScore F1 |
|---|---|---|
| Baseline TinyLlama | 3.7116 | 0.8732 |
| This model (Alpaca SFT) | 4.7111 | 0.8710 |
| Hyperparameter | Value |
|---|---|
| Method | QLoRA (4-bit NF4) |
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| Target modules | q_proj, v_proj |
| LoRA dropout | 0.05 |
| Learning rate | 3e-4 |
| Epochs | 2 |
| Dataset | tatsu-lab/alpaca (2,000 samples) |
| Hardware | Kaggle Tesla T4 |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "AnasTabba/tinyllama-alpaca-sft"
5tok = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
7
8prompt = "<|user|>\nExplain what machine learning is in simple terms.</s>\n<|assistant|>\n"
9inputs = tok(prompt, return_tensors="pt").to(model.device)
10out = model.generate(**inputs, max_new_tokens=200, temperature=0.7, do_sample=True)
11print(tok.decode(out[0], skip_special_tokens=True))