Instructions to use harmehak0173/qwen2.5-1.5b-fastapi-guardrails-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use harmehak0173/qwen2.5-1.5b-fastapi-guardrails-lora with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
π§ Qwen2.5-1.5B FastAPI Guardrails & RAG LoRA Adapter
A specialized Parameter-Efficient Fine-Tuned (PEFT / LoRA) adapter for Qwen/Qwen2.5-1.5B-Instruct tailored for FastAPI multi-tenant schema isolation, circuit breaker implementation, and grounded RAG citation alignment.
Developed by Harmehak Singh Khangura (Hugging Face Profile).
π Model Description
This model adapter enhances Qwen2.5-1.5B-Instruct with domain-specific knowledge in:
- FastAPI Backend Engineering: Dependency injection for multi-tenant schema isolation and JWT auth contracts.
- Resiliency & Circuit Breakers: Degradation patterns and circuit breaker states for external LLM APIs.
- Grounded RAG Systems: Citation alignment, quality gate similarity scoring, and hallucination reduction.
π How to Use
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE_MODEL = "Qwen/Qwen2.5-1.5B-Instruct"
LORA_ADAPTER = "harmehak0173/qwen2.5-1.5b-fastapi-guardrails-lora"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
torch_dtype=torch.float16,
device_map="auto"
)
# Load LoRA Adapter
model = PeftModel.from_pretrained(base_model, LORA_ADAPTER)
prompt = "<|im_start|>user\nHow do you implement a Circuit Breaker for external LLM APIs in Python?<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
π οΈ Training Details
Base Model: Qwen/Qwen2.5-1.5B-Instruct
Fine-Tuning Method: LoRA (Rank r=16, lora_alpha=32)
Target Modules: q_proj, k_proj, v_proj, o_proj
Trainer: Hugging Face TRL SFTTrainer
Format: ChatML (<|im_start|> / <|im_end|>)
- Downloads last month
- -