Views
No views yet
TinyLlama/TinyLlama-1.1B-Chat-v1.0 trained on 5,000 samples from the Alpaca dataset using QLoRA (4-bit quantization + LoRA adapters). LoRA weights are fully merged into the base model — drop-in ready for inference with standard transformers, no PEFT required.| Property | Value |
|---|---|
| Base model | TinyLlama/TinyLlama-1.1B-Chat-v1.0 |
| Parameters | ~1.1B |
| Fine-tuning method | QLoRA (4-bit NF4 + LoRA) |
| Dataset | tatsu-lab/alpaca (5,000 samples) |
| LoRA rank (r) | 8 |
| LoRA alpha | 16 |
| Target modules | q_proj, v_proj, k_proj, o_proj |
| Training epochs | 1 |
| Optimizer | paged_adamw_8bit |
| Precision | fp16 |
| Max sequence length | 512 |
1from transformers import pipeline
2
3pipe = pipeline("text-generation", model="sarimahsan101/tinyllama-alpaca-qlora")
4
5prompt = "### Instruction:\nExplain what gravity is.\n\n### Response:\n"
6output = pipe(
7 prompt,
8 max_new_tokens=150,
9 do_sample=True,
10 temperature=0.7,
11 repetition_penalty=1.3,
12 no_repeat_ngram_size=3,
13)
14print(output[0]["generated_text"])1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model_id = "sarimahsan101/tinyllama-alpaca-qlora"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.float16,
10 device_map="auto",
11)
12
13prompt = "### Instruction:\nWrite a short poem about the ocean.\n\n### Response:\n"
14inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
15
16with torch.no_grad():
17 out = model.generate(
18 **inputs,
19 max_new_tokens=150,
20 do_sample=True,
21 temperature=0.7,
22 repetition_penalty=1.3,
23 no_repeat_ngram_size=3,
24 pad_token_id=tokenizer.eos_token_id,
25 )
26
27print(tokenizer.decode(out[0], skip_special_tokens=True))### Instruction:
<your instruction here>
### Response:### Instruction:
<your instruction here>
### Input:
<additional context here>
### Response:### Instruction:
What is machine learning?
### Response:Machine learning is a branch of artificial intelligence that enables computers to
learn from data without being explicitly programmed. Instead of writing rules by
hand, you feed examples to an algorithm and it learns patterns on its own...transformerspefttrl — SFTTrainer + SFTConfigbitsandbytesdatasets| OPT-125M (QLoRA) | TinyLlama-1.1B (QLoRA) | |
|---|---|---|
| Parameters | 125M | 1.1B |
| Base capability | Weak | Strong (chat-pretrained) |
| Coherence | Basic | Good |
| Instruction following | Inconsistent | Consistent |
| GPU memory (inference) | ~1GB | ~2.5GB fp16 |
| Recommended for | Learning the pipeline | Actual use |