ef81e726c267e80436f321b7d71b4eae90753b1c
Model: vishnuamarapu/Full-Fine-Tuning-Qwen-2.5-0.5B-instruct-sft Source: Original Platform
license, language, pipeline_tag, library_name, base_model, tags
| license | language | pipeline_tag | library_name | base_model | tags | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| apache-2.0 |
|
text-generation | transformers | Qwen/Qwen2.5-0.5B-Instruct |
|
Supervised Fine-Tuned Qwen2.5-0.5B-Instruct (SFT)
This repository contains a Supervised Fine-Tuned (SFT) version of Qwen2.5-0.5B-Instruct. The model has been fine-tuned on a custom instruction-following conversational dataset to answer questions about Vishnu in a natural and helpful manner.
Model Details
- Base Model:
Qwen/Qwen2.5-0.5B-Instruct - Training Method: Supervised Fine-Tuning (SFT)
- Framework: Hugging Face Transformers
- Task: Conversational Text Generation
Installation
pip install transformers accelerate torch
Loading the Model
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
MODEL_ID = "vishnuamarapu/Full-Fine-Tuning-Qwen-2.5-0.5B-instruct-sft"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
Example Inference
messages = [
{
"role": "system",
"content": (
"You are Vishnu's personal AI assistant. "
"Answer questions about Vishnu using the provided information."
)
},
{
"role": "user",
"content": "Tell me about Vishnu."
}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(
text,
return_tensors="pt"
).to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256
)
response = tokenizer.decode(
outputs[0][inputs.input_ids.shape[-1]:],
skip_special_tokens=True
)
print(response)
Gradio Demo
import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
MODEL_ID = "vishnuamarapu/Full-Fine-Tuning-Qwen-2.5-0.5B-instruct-sft"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
def chat(message, history):
messages = [
{
"role": "system",
"content": (
"You are Vishnu's personal AI assistant. "
"Answer questions about Vishnu using the provided information."
)
}
]
for user, assistant in history:
messages.append({"role": "user", "content": user})
messages.append({"role": "assistant", "content": assistant})
messages.append({"role": "user", "content": message})
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(
text,
return_tensors="pt"
).to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256
)
response = tokenizer.decode(
outputs[0][inputs.input_ids.shape[-1]:],
skip_special_tokens=True
)
return response
gr.ChatInterface(chat).launch()
Generation Parameters
| Parameter | Value |
|---|---|
| max_new_tokens | 256 |
| device_map | auto |
| torch_dtype | float16 (GPU) / float32 (CPU) |
Repository Structure
config.json
generation_config.json
model.safetensors
tokenizer.json
tokenizer_config.json
chat_template.jinja
training_args.bin
Training Overview
This model was fine-tuned using Supervised Fine-Tuning (SFT) on a custom instruction-response dataset.
The training process included:
- Instruction-response formatting using the Qwen chat template
- Hugging Face Transformers
- TRL SFTTrainer
- PyTorch
- Custom conversational dataset
Citation
If you use this model in your work, please cite this repository.
@misc{vishnu_qwen25_sft,
author = {Vishnu Amarapu},
title = {Supervised Fine-Tuned Qwen2.5-0.5B-Instruct},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/vishnuamarapu/Full-Fine-Tuning-Qwen-2.5-0.5B-instruct-sft}}
}
Acknowledgements
- Alibaba Cloud Qwen Team for the base model.
- Hugging Face Transformers.
- TRL (Transformer Reinforcement Learning).
- PyTorch.
Description
Languages
Jinja
100%