arif-butt/arifbutt_dataset
Viewer β’ Updated β’ 1.93k β’ 7
How to use abubakaraabi786/tinyllama-peft-merged with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="abubakaraabi786/tinyllama-peft-merged")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("abubakaraabi786/tinyllama-peft-merged")
model = AutoModelForCausalLM.from_pretrained("abubakaraabi786/tinyllama-peft-merged")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use abubakaraabi786/tinyllama-peft-merged with PEFT:
Task type is invalid.
How to use abubakaraabi786/tinyllama-peft-merged with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "abubakaraabi786/tinyllama-peft-merged"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "abubakaraabi786/tinyllama-peft-merged",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/abubakaraabi786/tinyllama-peft-merged
How to use abubakaraabi786/tinyllama-peft-merged with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "abubakaraabi786/tinyllama-peft-merged" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "abubakaraabi786/tinyllama-peft-merged",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "abubakaraabi786/tinyllama-peft-merged" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "abubakaraabi786/tinyllama-peft-merged",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use abubakaraabi786/tinyllama-peft-merged with Docker Model Runner:
docker model run hf.co/abubakaraabi786/tinyllama-peft-merged
A fully merged, production-ready TinyLlama model fine-tuned with PEFT LoRA
| Attribute | Value |
|---|---|
| Model Size | 2.2 GB |
| Parameters | 1.1 Billion |
| Format | PyTorch Safetensors |
| Precision | FP16 |
| Context | 2048 tokens |
| Training Framework | PEFT + TRL |
| Inference | No PEFT required |
from transformers import AutoTokenizer, AutoModelForCausalLM
# One-liner to load
tokenizer = AutoTokenizer.from_pretrained("arif-butt/tinyllama-peft-merged")
model = AutoModelForCausalLM.from_pretrained(
"arif-butt/tinyllama-peft-merged",
torch_dtype=torch.float16,
device_map="auto"
)
# Generate
prompt = "Q: What courses does Arif teach?\nA:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
π¦ What's Inside
tinyllama-peft-merged/
βββ model.safetensors # 2.2 GB β merged weights
βββ config.json # Model architecture
βββ generation_config.json # Default generation settings
βββ tokenizer.json # Vocabulary (1.76 MB)
βββ tokenizer_config.json # Tokenizer settings
βββ special_tokens_map.json # Special tokens
No adapter files. No PEFT needed. Just load and go.
π§ Generation Settings
outputs = model.generate(
**inputs,
max_new_tokens=150,
temperature=0.7,
top_p=0.95,
do_sample=True,
repetition_penalty=1.1,
pad_token_id=tokenizer.eos_token_id,
)
π¬ Prompt Format
Q: Your question here?
A:
Example:
Q: What is deep learning?
A: Deep learning is a subset of machine learning...
Q: What is Python?
A: Python is a high-level, interpreted programming language known for its simple, readable syntax. It supports multiple programming paradigms including object-oriented, imperative, and functional programming.
Q: Explain gradient descent
A: Gradient descent is an optimization algorithm used to minimize the loss function in machine learning models. It works by iteratively moving parameters in the direction of the negative gradient.
Q: Name Arif's courses
A: Dr. Muhammad Arif Butt teaches Python Programming, Data Structures & Algorithms, Machine Learning, and Deep Learning courses.
Epoch 1: ββββββββββββββββββββ 0.8
Epoch 2: ββββββββββββββββββββ 0.4
Epoch 3: ββββββββββββββββββββ 0.05
Base model
TinyLlama/TinyLlama-1.1B-Chat-v1.0