Instructions to use rishini/qwen2.5-coder-7b-programming-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use rishini/qwen2.5-coder-7b-programming-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct") model = PeftModel.from_pretrained(base_model, "rishini/qwen2.5-coder-7b-programming-lora") - Transformers
How to use rishini/qwen2.5-coder-7b-programming-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rishini/qwen2.5-coder-7b-programming-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("rishini/qwen2.5-coder-7b-programming-lora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rishini/qwen2.5-coder-7b-programming-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rishini/qwen2.5-coder-7b-programming-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rishini/qwen2.5-coder-7b-programming-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/rishini/qwen2.5-coder-7b-programming-lora
- SGLang
How to use rishini/qwen2.5-coder-7b-programming-lora 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 "rishini/qwen2.5-coder-7b-programming-lora" \ --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": "rishini/qwen2.5-coder-7b-programming-lora", "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 "rishini/qwen2.5-coder-7b-programming-lora" \ --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": "rishini/qwen2.5-coder-7b-programming-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use rishini/qwen2.5-coder-7b-programming-lora with Docker Model Runner:
docker model run hf.co/rishini/qwen2.5-coder-7b-programming-lora
File size: 1,304 Bytes
f238825 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # Finetune + Eval Scripts
Scripts used to train and evaluate the adapters in this repo.
## Environment
```bash
python3 -m venv /home/ai/llama-finetune-env
/home/ai/llama-finetune-env/bin/pip install torch transformers accelerate peft bitsandbytes trl datasets huggingface_hub
```
GPU note: GPU 0 is occupied by vLLM; both scripts pin `CUDA_VISIBLE_DEVICES=1`.
## Programming model (this repo)
- `programming_finetune_aggressive.py` — trains `rishini/qwen2.5-coder-7b-programming-lora`
- Base: `Qwen/Qwen2.5-Coder-7B-Instruct`, LoRA r=64 alpha=128, 6k filtered CodeAlpaca examples, 3 epochs, completion-only masking.
- Output dir: `/home/ai/qwen-coder-programming-best`
- `eval_best_model.py` — held-out evaluation prompts, loads the adapter from `/home/ai/qwen-coder-programming-best`.
## Security model (other work)
- `security_finetune.py` — CodeLlama-7B-Instruct + LoRA for vulnerability analysis.
- Base: `codellama/CodeLlama-7b-Instruct-hf`, output dir: `/home/ai/codellama-security-finetuned`
- `test_security_model.py` — runs the security adapter on sample vulnerable snippets.
## Run
```bash
cd /home/ai
/home/ai/llama-finetune-env/bin/python programming_finetune_aggressive.py # train
/home/ai/llama-finetune-env/bin/python eval_best_model.py # eval
```
|