Update README.md
Browse files
README.md
CHANGED
|
@@ -1,202 +1,156 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
|
| 3 |
-
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
-
|
| 28 |
-
### Model Sources [optional]
|
| 29 |
-
|
| 30 |
-
<!-- Provide the basic links for the model. -->
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
-
|
| 36 |
-
## Uses
|
| 37 |
-
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
-
|
| 40 |
-
### Direct Use
|
| 41 |
-
|
| 42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
-
|
| 46 |
-
### Downstream Use [optional]
|
| 47 |
-
|
| 48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
-
|
| 50 |
-
[More Information Needed]
|
| 51 |
-
|
| 52 |
-
### Out-of-Scope Use
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
## Bias, Risks, and Limitations
|
| 59 |
-
|
| 60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
### Recommendations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
-
|
| 70 |
-
## How to Get Started with the Model
|
| 71 |
-
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
-
|
| 74 |
-
[More Information Needed]
|
| 75 |
-
|
| 76 |
-
## Training Details
|
| 77 |
-
|
| 78 |
-
### Training Data
|
| 79 |
-
|
| 80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
| 89 |
|
| 90 |
-
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
|
| 101 |
-
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
-
|
|
|
|
| 108 |
|
| 109 |
-
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
| 116 |
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
-
|
| 122 |
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
|
| 126 |
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
|
| 130 |
|
| 131 |
-
|
| 132 |
|
|
|
|
| 133 |
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
| 200 |
-
### Framework versions
|
| 201 |
|
| 202 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- zig
|
| 7 |
+
- code
|
| 8 |
+
- programming
|
| 9 |
+
- lora
|
| 10 |
+
- qwen2.5-coder
|
| 11 |
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
|
| 12 |
+
model_type: qwen2.5
|
| 13 |
+
library_name: transformers
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# ZigNet Qwen2.5-Coder-7B
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
**Fine-tuned Qwen2.5-Coder-7B for Zig programming language analysis and assistance**
|
| 19 |
|
| 20 |
+
This model is part of the [ZigNet](https://github.com/fulgidus/zignet) project - an MCP (Model Context Protocol) server that provides intelligent Zig code analysis for Claude and other LLMs.
|
| 21 |
|
| 22 |
## Model Details
|
| 23 |
|
| 24 |
+
- **Base Model**: [Qwen/Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct)
|
| 25 |
+
- **Fine-tuning Method**: QLoRA (4-bit quantization)
|
| 26 |
+
- **Training Data**: 13,756 Zig code examples from official documentation (v0.13-0.15)
|
| 27 |
+
- **Supported Zig Versions**: 0.13.x, 0.14.x, 0.15.x
|
| 28 |
+
- **Training Hardware**: NVIDIA RTX 3090 (24GB VRAM)
|
| 29 |
+
- **Adapter Size**: ~155MB (LoRA adapters only)
|
| 30 |
+
|
| 31 |
+
## Training Configuration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
```python
|
| 34 |
+
LoraConfig:
|
| 35 |
+
- r: 16
|
| 36 |
+
- lora_alpha: 32
|
| 37 |
+
- target_modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
|
| 38 |
+
- lora_dropout: 0.05
|
| 39 |
+
- bias: "none"
|
| 40 |
+
|
| 41 |
+
TrainingArguments:
|
| 42 |
+
- num_train_epochs: 3
|
| 43 |
+
- per_device_train_batch_size: 16
|
| 44 |
+
- learning_rate: 2e-4
|
| 45 |
+
- warmup_steps: 100
|
| 46 |
+
- fp16: true
|
| 47 |
+
```
|
| 48 |
|
| 49 |
+
## Dataset
|
| 50 |
+
|
| 51 |
+
The model was trained on a curated dataset of Zig examples including:
|
| 52 |
+
- Official Zig documentation examples (v0.13, v0.14, v0.15)
|
| 53 |
+
- Advanced features: comptime, generics, error handling, async
|
| 54 |
+
- Real-world code patterns from popular Zig projects
|
| 55 |
|
| 56 |
+
**Dataset**: [fulgidus/zignet-training-dataset](https://huggingface.co/datasets/fulgidus/zignet-training-dataset)
|
| 57 |
|
| 58 |
+
## Intended Use
|
| 59 |
|
| 60 |
+
This model is designed to:
|
| 61 |
+
- 📖 Provide Zig documentation context
|
| 62 |
+
- 💡 Suggest intelligent code fixes for Zig errors
|
| 63 |
+
- 🔍 Explain Zig-specific idioms and patterns
|
| 64 |
+
- ⚡ Generate idiomatic Zig code
|
| 65 |
|
| 66 |
+
**Note**: This model is NOT used for parsing or validation (handled by deterministic compiler-based tools). It focuses on documentation lookup and intelligent suggestions.
|
| 67 |
|
| 68 |
+
## Performance
|
| 69 |
|
| 70 |
+
- **Quality**: ⭐⭐⭐⭐⭐ Best-in-class for Zig syntax and idioms
|
| 71 |
+
- **Benchmarks**: 100% pass rate on Zig validation tests
|
| 72 |
+
- **Response Time**: ~15-20s (after GGUF quantization)
|
| 73 |
|
| 74 |
+
## Usage
|
| 75 |
|
| 76 |
+
### With Transformers
|
| 77 |
|
| 78 |
+
```python
|
| 79 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 80 |
+
from peft import PeftModel
|
| 81 |
|
| 82 |
+
# Load base model
|
| 83 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 84 |
+
"Qwen/Qwen2.5-Coder-7B-Instruct",
|
| 85 |
+
torch_dtype=torch.float16,
|
| 86 |
+
device_map="auto"
|
| 87 |
+
)
|
| 88 |
|
| 89 |
+
# Load LoRA adapters
|
| 90 |
+
model = PeftModel.from_pretrained(base_model, "fulgidus/zignet-qwen2.5-coder-7b")
|
| 91 |
|
| 92 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct")
|
| 93 |
|
| 94 |
+
# Generate
|
| 95 |
+
prompt = "Explain Zig comptime feature with an example"
|
| 96 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 97 |
+
outputs = model.generate(**inputs, max_length=500)
|
| 98 |
+
print(tokenizer.decode(outputs[0]))
|
| 99 |
+
```
|
| 100 |
|
| 101 |
+
### With ZigNet MCP Server
|
| 102 |
|
| 103 |
+
This model is integrated into ZigNet for use with Claude:
|
| 104 |
|
| 105 |
+
```bash
|
| 106 |
+
# Install ZigNet
|
| 107 |
+
git clone https://github.com/fulgidus/zignet
|
| 108 |
+
cd zignet
|
| 109 |
+
pnpm install
|
| 110 |
+
pnpm run build
|
| 111 |
|
| 112 |
+
# Configure MCP client (Claude Desktop)
|
| 113 |
+
# Add to ~/Library/Application Support/Claude/claude_desktop_config.json
|
| 114 |
+
{
|
| 115 |
+
"mcpServers": {
|
| 116 |
+
"zignet": {
|
| 117 |
+
"command": "node",
|
| 118 |
+
"args": ["/path/to/zignet/dist/mcp-server.js"]
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
```
|
| 123 |
|
| 124 |
+
## Limitations
|
| 125 |
|
| 126 |
+
- Focused on Zig 0.13-0.15 (may have limited accuracy on very old or very new syntax)
|
| 127 |
+
- LoRA adapters only (requires base model for inference)
|
| 128 |
+
- Optimized for English documentation and comments
|
| 129 |
+
- Not suitable for real-time parsing (use ZigNet's AST parser for that)
|
| 130 |
|
| 131 |
+
## Citation
|
| 132 |
|
| 133 |
+
```bibtex
|
| 134 |
+
@software{zignet2025,
|
| 135 |
+
author = {fulgidus},
|
| 136 |
+
title = {ZigNet: Intelligent Zig Code Analysis via MCP},
|
| 137 |
+
year = {2025},
|
| 138 |
+
url = {https://github.com/fulgidus/zignet}
|
| 139 |
+
}
|
| 140 |
+
```
|
| 141 |
|
| 142 |
+
## License
|
| 143 |
|
| 144 |
+
Apache-2.0 (same as base model)
|
| 145 |
|
| 146 |
+
## Acknowledgments
|
| 147 |
|
| 148 |
+
- **Base Model**: [Qwen2.5-Coder](https://github.com/QwenLM/Qwen2.5-Coder) by Alibaba Cloud
|
| 149 |
+
- **Zig Language**: [ziglang.org](https://ziglang.org)
|
| 150 |
+
- **Training Framework**: HuggingFace Transformers + PEFT
|
| 151 |
|
| 152 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
| 154 |
+
**Project**: [github.com/fulgidus/zignet](https://github.com/fulgidus/zignet)
|
| 155 |
+
**Author**: fulgidus
|
| 156 |
+
**Date**: October 2025
|