Text Generation
Transformers
Safetensors
English
qwen2
code
code-review
programming
qlora
unsloth
qwen2.5
bug-detection
conversational
text-generation-inference
Instructions to use sriksven/ExtractIQ-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sriksven/ExtractIQ-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sriksven/ExtractIQ-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sriksven/ExtractIQ-7B") model = AutoModelForCausalLM.from_pretrained("sriksven/ExtractIQ-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use sriksven/ExtractIQ-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sriksven/ExtractIQ-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriksven/ExtractIQ-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sriksven/ExtractIQ-7B
- SGLang
How to use sriksven/ExtractIQ-7B 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 "sriksven/ExtractIQ-7B" \ --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": "sriksven/ExtractIQ-7B", "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 "sriksven/ExtractIQ-7B" \ --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": "sriksven/ExtractIQ-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use sriksven/ExtractIQ-7B with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for sriksven/ExtractIQ-7B to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for sriksven/ExtractIQ-7B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for sriksven/ExtractIQ-7B to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="sriksven/ExtractIQ-7B", max_seq_length=2048, ) - Docker Model Runner
How to use sriksven/ExtractIQ-7B with Docker Model Runner:
docker model run hf.co/sriksven/ExtractIQ-7B
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen2.5-7B-Instruct
|
| 4 |
+
tags:
|
| 5 |
+
- code
|
| 6 |
+
- code-review
|
| 7 |
+
- programming
|
| 8 |
+
- qlora
|
| 9 |
+
- unsloth
|
| 10 |
+
- qwen2.5
|
| 11 |
+
- bug-detection
|
| 12 |
+
datasets:
|
| 13 |
+
- sahil2801/CodeAlpaca-20k
|
| 14 |
+
language:
|
| 15 |
+
- en
|
| 16 |
+
pipeline_tag: text-generation
|
| 17 |
+
library_name: transformers
|
| 18 |
+
model-index:
|
| 19 |
+
- name: CodeLens-7B
|
| 20 |
+
results: []
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# CodeLens-7B
|
| 24 |
+
|
| 25 |
+
A fine-tuned **Qwen2.5-7B-Instruct** model specialized for **code review, bug detection, and programming assistance**. It analyzes code snippets, identifies issues, suggests improvements, and writes clean solutions across multiple programming languages.
|
| 26 |
+
|
| 27 |
+
## Key Details
|
| 28 |
+
|
| 29 |
+
| | |
|
| 30 |
+
|---|---|
|
| 31 |
+
| **Base model** | Qwen/Qwen2.5-7B-Instruct |
|
| 32 |
+
| **Method** | QLoRA (4-bit NF4, rank 16, alpha 16) |
|
| 33 |
+
| **Library** | Unsloth + TRL SFTTrainer |
|
| 34 |
+
| **Dataset** | sahil2801/CodeAlpaca-20k (10K examples) |
|
| 35 |
+
| **Hardware** | NVIDIA RTX A5000 (24GB VRAM) on RunPod |
|
| 36 |
+
| **Training time** | ~2.65 hours (500 steps) |
|
| 37 |
+
| **Final loss** | 0.450 |
|
| 38 |
+
| **Parameters trained** | 40.4M of 7.66B (0.53%) |
|
| 39 |
+
| **Format** | ChatML |
|
| 40 |
+
| **Output** | Merged 16-bit safetensors |
|
| 41 |
+
|
| 42 |
+
## Dataset
|
| 43 |
+
|
| 44 |
+
Trained on 10,000 examples from [sahil2801/CodeAlpaca-20k](https://huggingface.co/datasets/sahil2801/CodeAlpaca-20k), a code instruction-following dataset covering code generation, debugging, explanation, and review tasks across Python, JavaScript, Java, C, SQL, and more.
|
| 45 |
+
|
| 46 |
+
## Usage
|
| 47 |
+
|
| 48 |
+
### Transformers
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 52 |
+
|
| 53 |
+
model = AutoModelForCausalLM.from_pretrained("sriksven/CodeLens-7B")
|
| 54 |
+
tokenizer = AutoTokenizer.from_pretrained("sriksven/CodeLens-7B")
|
| 55 |
+
|
| 56 |
+
messages = [
|
| 57 |
+
{
|
| 58 |
+
"role": "system",
|
| 59 |
+
"content": "You are an expert code reviewer and programmer. Analyze code, find bugs, suggest improvements, and write clean efficient solutions.",
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"role": "user",
|
| 63 |
+
"content": "Review this Python function for bugs and improvements:\n\ndef find_duplicates(lst):\n seen = []\n dupes = []\n for i in lst:\n if i in seen:\n dupes.append(i)\n seen.append(i)\n return dupes",
|
| 64 |
+
},
|
| 65 |
+
]
|
| 66 |
+
|
| 67 |
+
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
|
| 68 |
+
outputs = model.generate(inputs, max_new_tokens=512)
|
| 69 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
### Unsloth (faster inference)
|
| 73 |
+
|
| 74 |
+
```python
|
| 75 |
+
from unsloth import FastLanguageModel
|
| 76 |
+
|
| 77 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 78 |
+
model_name="sriksven/CodeLens-7B",
|
| 79 |
+
max_seq_length=2048,
|
| 80 |
+
load_in_4bit=True,
|
| 81 |
+
)
|
| 82 |
+
FastLanguageModel.for_inference(model)
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## Capabilities
|
| 86 |
+
|
| 87 |
+
- **Code review** — analyze code for bugs, anti-patterns, and style issues
|
| 88 |
+
- **Bug detection** — identify logical errors, off-by-one mistakes, edge cases
|
| 89 |
+
- **Code generation** — write functions, classes, and scripts from descriptions
|
| 90 |
+
- **Code explanation** — explain what a piece of code does step by step
|
| 91 |
+
- **Refactoring suggestions** — propose cleaner, more efficient alternatives
|
| 92 |
+
- **Multi-language** — Python, JavaScript, Java, C/C++, SQL, HTML/CSS, and more
|
| 93 |
+
|
| 94 |
+
## Intended Use
|
| 95 |
+
|
| 96 |
+
- Local code review assistant
|
| 97 |
+
- Programming tutoring and education
|
| 98 |
+
- Code quality tooling in CI/CD pipelines
|
| 99 |
+
- Prototyping developer tools with local LLMs
|
| 100 |
+
|
| 101 |
+
## Limitations
|
| 102 |
+
|
| 103 |
+
- Trained on instruction-following code data, not real code review conversations from PRs
|
| 104 |
+
- May not catch security vulnerabilities that require deep context
|
| 105 |
+
- Code suggestions should be tested before use in production
|
| 106 |
+
- Best with shorter code snippets (functions/classes) rather than full files
|
| 107 |
+
- No execution or testing capability — suggestions are pattern-based
|
| 108 |
+
|
| 109 |
+
## Training Metrics
|
| 110 |
+
|
| 111 |
+
Loss decreased steadily from 2.17 to 0.27 over 500 steps (~13 epochs), indicating strong learning on the code instruction data.
|
| 112 |
+
|
| 113 |
+
| Step | Loss | Epoch |
|
| 114 |
+
|---|---|---|
|
| 115 |
+
| 10 | 2.168 | 0.26 |
|
| 116 |
+
| 100 | 0.503 | 2.05 |
|
| 117 |
+
| 250 | 0.430 | 6.41 |
|
| 118 |
+
| 400 | 0.310 | 10.26 |
|
| 119 |
+
| 500 | 0.278 | 12.83 |
|
| 120 |
+
|
| 121 |
+
## Training Infrastructure
|
| 122 |
+
|
| 123 |
+
| | |
|
| 124 |
+
|---|---|
|
| 125 |
+
| **GPU** | NVIDIA RTX A5000 24GB |
|
| 126 |
+
| **Cloud** | RunPod ($0.27/hr) |
|
| 127 |
+
| **Framework** | Unsloth 2026.5.2 + TRL + Transformers 5.5.0 |
|
| 128 |
+
| **Precision** | BF16 training, 4-bit NF4 base quantization |
|
| 129 |
+
| **Optimizer** | AdamW 8-bit |
|
| 130 |
+
| **Learning rate** | 2e-4, linear decay |
|
| 131 |
+
| **Batch size** | 16 effective (4 per device × 4 accumulation) |
|
| 132 |
+
| **Packing** | Enabled |
|
| 133 |
+
|
| 134 |
+
## Source Code
|
| 135 |
+
|
| 136 |
+
Training scripts: [github.com/sriksven/LLM-FineTune-Suite](https://github.com/sriksven/LLM-FineTune-Suite)
|
| 137 |
+
|
| 138 |
+
## License
|
| 139 |
+
|
| 140 |
+
Apache 2.0
|