🤖 Aryan Maurya's Fine-Tuned Qwen2.5-0.5B
This is a fine-tuned LoRA adapter model built upon Qwen/Qwen2.5-0.5B-Instruct.
- Developer: Aryan Maurya (AryanRN0)
- Base Model:
Qwen/Qwen2.5-0.5B-Instruct - Method: LoRA (Low-Rank Adaptation)
- Trained with: Hugging Face
transformers&peft
🚀 How to Use
You can load and chat with this fine-tuned model using Python and transformers / peft:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "Qwen/Qwen2.5-0.5B-Instruct"
adapter_id = "AryanRN0/my-first-llm"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float32,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
messages = [{"role": "user", "content": "What is machine learning?"}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.7)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
⚙️ Training Details
- LoRA Rank (r): 8
- LoRA Alpha: 16
- Target Modules:
q_proj,k_proj,v_proj,o_proj - Learning Rate: 3e-4
- Epochs: 3