File size: 4,502 Bytes
631df9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1fbe23f
631df9e
1fbe23f
631df9e
1fbe23f
631df9e
1fbe23f
631df9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1fbe23f
 
 
631df9e
1fbe23f
631df9e
 
1fbe23f
631df9e
1fbe23f
631df9e
 
1fbe23f
 
 
631df9e
 
 
 
 
 
 
 
 
 
 
 
 
 
1fbe23f
631df9e
 
 
 
 
 
 
 
1fbe23f
631df9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1fbe23f
631df9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
language:
- en
license: apache-2.0
base_model: unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit
tags:
- text-generation-inference
- transformers
- unsloth
- qwen2
- trl
- nodejs
- javascript
- backend
- express
- gguf
- ollama
pipeline_tag: text-generation
---

# πŸš€ nodejs-coder-qwen25

A fine-tuned **Qwen2.5-Coder-7B-Instruct** model specialized for **Node.js backend development**, trained with LoRA adapters using Unsloth, merged into a single GGUF file for efficient local inference with Ollama.

---

## 🧠 Model Description

| Property | Details |
|----------|---------|
| **Base Model** | `Qwen2.5-Coder-7B-Instruct` |
| **Fine-tuning Method** | LoRA (Low-Rank Adaptation) via Unsloth |
| **Training Framework** | TRL SFTTrainer |
| **Quantization** | GGUF Q4_K_M (~4.4 GB) |
| **Context Length** | 2048 tokens |
| **Language** | JavaScript / Node.js |

This model is specifically trained to write clean, production-ready Node.js backend code. It understands common backend patterns including REST APIs, database integrations, authentication, and testing.

---

## 🎯 Specialties

- βœ… **Express.js** β€” REST APIs, middleware, routing
- βœ… **NestJS** β€” modules, controllers, services, guards
- βœ… **Sequelize / Prisma** β€” ORM models, migrations, queries
- βœ… **MongoDB / Mongoose** β€” schemas, models, aggregations
- βœ… **PostgreSQL / pg** β€” raw queries, connection pooling
- βœ… **JWT Authentication** β€” login, token generation, guards
- βœ… **Jest** β€” unit tests, mocking, integration tests
- βœ… **Async/Await** β€” file I/O, error handling, promises

---

## ⚑ Quick Start with Ollama

### Step 1 β€” Download files
```bash
hf download Sriram-214/nodejs-coder-qwen25 nodejs-coder-Q4_K_M.gguf --local-dir ./
hf download Sriram-214/nodejs-coder-qwen25 Modelfile --local-dir ./
```

### Step 2 β€” Create Ollama model
```bash
ollama create nodejs-coder -f Modelfile
```

### Step 3 β€” Run
```bash
ollama run nodejs-coder
```

---

## πŸ“‹ Modelfile

```dockerfile
FROM ./nodejs-coder-Q4_K_M.gguf

PARAMETER temperature 0.7
PARAMETER top_p 0.9
PARAMETER repeat_penalty 1.1
PARAMETER num_ctx 2048
PARAMETER num_gpu 0
PARAMETER stop "<|im_end|>"
PARAMETER stop "<|im_start|>"

TEMPLATE """<|im_start|>system
{{ .System }}<|im_end|>
<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
"""

SYSTEM """You are a Node.js backend development expert. You write clean, efficient, production-ready code following best practices. You specialize in Express.js, NestJS, Sequelize, Prisma, MongoDB, PostgreSQL, and Jest testing. Always include error handling and follow RESTful API design principles."""
```

> **Note:** Set `num_gpu 0` for CPU-only mode on GPUs with ≀6GB VRAM. For GPUs with more VRAM, increase this value.

---

## πŸ’¬ Example Prompts & Outputs

### Express REST API
**Prompt:** `Write a simple Express.js REST API with a GET /health endpoint`

```javascript
const express = require('express');
const app = express();

app.get('/health', (req, res) => {
  res.status(200).json({ status: 'ok' });
});

app.listen(3000, () => console.log('Server running on port 3000'));
```

### Async File Reading
**Prompt:** `Write a Node.js function that reads a JSON file using async/await`

```javascript
const fs = require('fs').promises;

async function readJsonFile(filePath) {
  try {
    const data = await fs.readFile(filePath, 'utf-8');
    return JSON.parse(data);
  } catch (error) {
    throw new Error(`Failed to read file: ${error.message}`);
  }
}
```

### List Directory Files
**Prompt:** `Write a simple Node.js code to list all the files in a directory`

```javascript
const fs = require('fs');

fs.readdir('./', (err, files) => {
  if (err) throw err;
  console.log(files);
});
```

---

## πŸ‹οΈ Training Details

| Parameter | Value |
|-----------|-------|
| **Base Model** | `unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit` |
| **LoRA Rank** | 16 |
| **LoRA Alpha** | 32 |
| **Training Data** | Node.js backend code dataset |
| **Training Framework** | Unsloth + TRL SFTTrainer |
| **Training Environment** | Google Colab (T4 GPU) |
| **Quantization** | Q4_K_M via llama.cpp |

---

## ⚠️ Limitations

- Optimized for Node.js/JavaScript β€” not suited for other languages
- Context window of 2048 tokens β€” long files may be truncated
- CPU inference is slow (~3-5 tokens/sec on modern CPUs)
- May occasionally produce outdated library syntax

---

## πŸ“„ License

Apache 2.0 β€” see [LICENSE](https://www.apache.org/licenses/LICENSE-2.0)