Downloads · 30 days
0
vishnuamarapu/Full-Fine-Tuning-Qwen-2.5-0.5B-instruct-LORA
Full-Fine-Tuning-Qwen-2.5-0.5B-instruct-LORA is a text generation model from vishnuamarapu. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This repository contains a LoRA (Low-Rank Adaptation) fine-tuned version of Qwen2.5-0.5B-Instruct. The repository stores only the LoRA adapter weights, making it lightweight and easy to share. To use this model, first…
Downloads · 30 days
0
Access
Public
Updated Jun 26, 2026
Repo size
46.7 MB
Likes
0
Public
Click a slice to open those files.
.safetensors35.2 MB · 76%
From the Hugging Face model README
This repository contains a LoRA (Low-Rank Adaptation) fine-tuned version of Qwen2.5-0.5B-Instruct. The repository stores only the LoRA adapter weights, making it lightweight and easy to share. To use this model, first load the base model and then apply the LoRA adapter.
Qwen/Qwen2.5-0.5B-Instructpip install transformers peft accelerate torch safetensors
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE_MODEL = "Qwen/Qwen2.5-0.5B-Instruct"
LORA_MODEL = "vishnuamarapu/Full-Fine-Tuning-Qwen-2.5-0.5B-instruct-LORA"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
model = PeftModel.from_pretrained(
base_model,
LORA_MODEL
)
model.eval()
messages = [
{
"role": "system",
"content": (
"You are Vishnu's personal AI assistant. "
"Answer questions about Vishnu."
)
},
{
"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)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
do_sample=True,
top_p=0.9,
repetition_penalty=1.1,
)
response = tokenizer.decode(
outputs[0][inputs.input_ids.shape[-1]:],
skip_special_tokens=True,
)
print(response)
import torch
import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE_MODEL = "Qwen/Qwen2.5-0.5B-Instruct"
LORA_MODEL = "vishnuamarapu/Full-Fine-Tuning-Qwen-2.5-0.5B-instruct-LORA"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
model = PeftModel.from_pretrained(
base_model,
LORA_MODEL
)
model.eval()
SYSTEM_PROMPT = (
""" You are Vishnu's personal AI assistant.
Always answer using the information you have learned about Vishnu.
Do not invent facts.
If you do not know the answer, say you don't know.
Answer as Vishnu in first person."""
)
def generate(message, history):
messages = [
{
"role": "system",
"content": SYSTEM_PROMPT,
}
]
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)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
do_sample=True,
top_p=0.9,
repetition_penalty=1.1,
)
answer = tokenizer.decode(
outputs[0][inputs.input_ids.shape[-1]:],
skip_special_tokens=True,
)
return answer
gr.ChatInterface(
fn=generate,
title="Vishnu Personal AI",
description="LoRA Fine-Tuned Qwen2.5-0.5B-Instruct",
).launch()
| Parameter | Value |
|---|---|
| max_new_tokens | 256 |
| temperature | 0.7 |
| top_p | 0.9 |
| repetition_penalty | 1.1 |
| device_map | auto |
| torch_dtype | float16 (GPU) / float32 (CPU) |
adapter_config.json
adapter_model.safetensors
chat_template.jinja
tokenizer.json
tokenizer_config.json
README.md
This model was fine-tuned using LoRA (Low-Rank Adaptation) through the PEFT library. Only a small set of trainable adapter weights were updated while the base model remained frozen, resulting in a lightweight adapter that can be merged with the original base model for inference.
If you use this model in your work, please cite this repository.
@misc{vishnu_qwen25_lora,
author = {Vishnu Amarapu},
title = {LoRA 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-LORA}}
}