Instructions to use AryanRN0/my-first-llm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use AryanRN0/my-first-llm with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct") model = PeftModel.from_pretrained(base_model, "AryanRN0/my-first-llm") - Transformers
How to use AryanRN0/my-first-llm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AryanRN0/my-first-llm") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AryanRN0/my-first-llm", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AryanRN0/my-first-llm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AryanRN0/my-first-llm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AryanRN0/my-first-llm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AryanRN0/my-first-llm
- SGLang
How to use AryanRN0/my-first-llm with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AryanRN0/my-first-llm" \ --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": "AryanRN0/my-first-llm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "AryanRN0/my-first-llm" \ --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": "AryanRN0/my-first-llm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AryanRN0/my-first-llm with Docker Model Runner:
docker model run hf.co/AryanRN0/my-first-llm
π€ 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
- Downloads last month
- 65