Sriram-214 commited on
Commit
631df9e
Β·
verified Β·
1 Parent(s): 1fbe23f

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +157 -21
README.md CHANGED
@@ -1,37 +1,173 @@
1
- # nodejs-coder-qwen25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- A fine-tuned **Qwen2.5-Coder-7B** model specialized for Node.js backend development, merged and quantized to GGUF (Q4_K_M) for local inference with Ollama.
4
 
5
- ## Model Details
6
- - **Base Model:** `unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit`
7
- - **Fine-tuning:** LoRA adapters merged into base weights
8
- - **Format:** GGUF Q4_K_M (~4.4 GB)
9
- - **Specialties:** Express.js, NestJS, Sequelize, Prisma, MongoDB, PostgreSQL, Jest
10
 
11
- ## Quick Start with Ollama
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ```bash
14
- # 1. Download the GGUF
15
  hf download Sriram-214/nodejs-coder-qwen25 nodejs-coder-Q4_K_M.gguf --local-dir ./
16
-
17
- # 2. Download the Modelfile
18
  hf download Sriram-214/nodejs-coder-qwen25 Modelfile --local-dir ./
 
19
 
20
- # 3. Create the Ollama model
 
21
  ollama create nodejs-coder -f Modelfile
 
22
 
23
- # 4. Run it
 
24
  ollama run nodejs-coder
25
  ```
26
 
27
- ## Modelfile Configuration
28
- The included `Modelfile` uses the correct **Qwen2 chat template** with proper stop tokens.
29
- For GPUs with limited VRAM (≀6GB), `num_gpu 0` forces CPU inference.
 
 
 
 
 
 
 
 
 
 
 
30
 
31
- ## Example Prompts
 
 
 
 
 
 
 
32
  ```
33
- Write a Node.js REST API with Express and JWT authentication
34
- Create a Mongoose model for a User with name, email and age
35
- Write a pg query to fetch paginated users with error handling
36
- Write Jest unit tests for an Express route handler
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ base_model: unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit
6
+ tags:
7
+ - text-generation-inference
8
+ - transformers
9
+ - unsloth
10
+ - qwen2
11
+ - trl
12
+ - nodejs
13
+ - javascript
14
+ - backend
15
+ - express
16
+ - gguf
17
+ - ollama
18
+ pipeline_tag: text-generation
19
+ ---
20
 
21
+ # πŸš€ nodejs-coder-qwen25
22
 
23
+ 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.
 
 
 
 
24
 
25
+ ---
26
 
27
+ ## 🧠 Model Description
28
+
29
+ | Property | Details |
30
+ |----------|---------|
31
+ | **Base Model** | `Qwen2.5-Coder-7B-Instruct` |
32
+ | **Fine-tuning Method** | LoRA (Low-Rank Adaptation) via Unsloth |
33
+ | **Training Framework** | TRL SFTTrainer |
34
+ | **Quantization** | GGUF Q4_K_M (~4.4 GB) |
35
+ | **Context Length** | 2048 tokens |
36
+ | **Language** | JavaScript / Node.js |
37
+
38
+ 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.
39
+
40
+ ---
41
+
42
+ ## 🎯 Specialties
43
+
44
+ - βœ… **Express.js** β€” REST APIs, middleware, routing
45
+ - βœ… **NestJS** β€” modules, controllers, services, guards
46
+ - βœ… **Sequelize / Prisma** β€” ORM models, migrations, queries
47
+ - βœ… **MongoDB / Mongoose** β€” schemas, models, aggregations
48
+ - βœ… **PostgreSQL / pg** β€” raw queries, connection pooling
49
+ - βœ… **JWT Authentication** β€” login, token generation, guards
50
+ - βœ… **Jest** β€” unit tests, mocking, integration tests
51
+ - βœ… **Async/Await** β€” file I/O, error handling, promises
52
+
53
+ ---
54
+
55
+ ## ⚑ Quick Start with Ollama
56
+
57
+ ### Step 1 β€” Download files
58
  ```bash
 
59
  hf download Sriram-214/nodejs-coder-qwen25 nodejs-coder-Q4_K_M.gguf --local-dir ./
 
 
60
  hf download Sriram-214/nodejs-coder-qwen25 Modelfile --local-dir ./
61
+ ```
62
 
63
+ ### Step 2 β€” Create Ollama model
64
+ ```bash
65
  ollama create nodejs-coder -f Modelfile
66
+ ```
67
 
68
+ ### Step 3 β€” Run
69
+ ```bash
70
  ollama run nodejs-coder
71
  ```
72
 
73
+ ---
74
+
75
+ ## πŸ“‹ Modelfile
76
+
77
+ ```dockerfile
78
+ FROM ./nodejs-coder-Q4_K_M.gguf
79
+
80
+ PARAMETER temperature 0.7
81
+ PARAMETER top_p 0.9
82
+ PARAMETER repeat_penalty 1.1
83
+ PARAMETER num_ctx 2048
84
+ PARAMETER num_gpu 0
85
+ PARAMETER stop "<|im_end|>"
86
+ PARAMETER stop "<|im_start|>"
87
 
88
+ TEMPLATE """<|im_start|>system
89
+ {{ .System }}<|im_end|>
90
+ <|im_start|>user
91
+ {{ .Prompt }}<|im_end|>
92
+ <|im_start|>assistant
93
+ """
94
+
95
+ 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."""
96
  ```
97
+
98
+ > **Note:** Set `num_gpu 0` for CPU-only mode on GPUs with ≀6GB VRAM. For GPUs with more VRAM, increase this value.
99
+
100
+ ---
101
+
102
+ ## πŸ’¬ Example Prompts & Outputs
103
+
104
+ ### Express REST API
105
+ **Prompt:** `Write a simple Express.js REST API with a GET /health endpoint`
106
+
107
+ ```javascript
108
+ const express = require('express');
109
+ const app = express();
110
+
111
+ app.get('/health', (req, res) => {
112
+ res.status(200).json({ status: 'ok' });
113
+ });
114
+
115
+ app.listen(3000, () => console.log('Server running on port 3000'));
116
+ ```
117
+
118
+ ### Async File Reading
119
+ **Prompt:** `Write a Node.js function that reads a JSON file using async/await`
120
+
121
+ ```javascript
122
+ const fs = require('fs').promises;
123
+
124
+ async function readJsonFile(filePath) {
125
+ try {
126
+ const data = await fs.readFile(filePath, 'utf-8');
127
+ return JSON.parse(data);
128
+ } catch (error) {
129
+ throw new Error(`Failed to read file: ${error.message}`);
130
+ }
131
+ }
132
+ ```
133
+
134
+ ### List Directory Files
135
+ **Prompt:** `Write a simple Node.js code to list all the files in a directory`
136
+
137
+ ```javascript
138
+ const fs = require('fs');
139
+
140
+ fs.readdir('./', (err, files) => {
141
+ if (err) throw err;
142
+ console.log(files);
143
+ });
144
  ```
145
+
146
+ ---
147
+
148
+ ## πŸ‹οΈ Training Details
149
+
150
+ | Parameter | Value |
151
+ |-----------|-------|
152
+ | **Base Model** | `unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit` |
153
+ | **LoRA Rank** | 16 |
154
+ | **LoRA Alpha** | 32 |
155
+ | **Training Data** | Node.js backend code dataset |
156
+ | **Training Framework** | Unsloth + TRL SFTTrainer |
157
+ | **Training Environment** | Google Colab (T4 GPU) |
158
+ | **Quantization** | Q4_K_M via llama.cpp |
159
+
160
+ ---
161
+
162
+ ## ⚠️ Limitations
163
+
164
+ - Optimized for Node.js/JavaScript β€” not suited for other languages
165
+ - Context window of 2048 tokens β€” long files may be truncated
166
+ - CPU inference is slow (~3-5 tokens/sec on modern CPUs)
167
+ - May occasionally produce outdated library syntax
168
+
169
+ ---
170
+
171
+ ## πŸ“„ License
172
+
173
+ Apache 2.0 β€” see [LICENSE](https://www.apache.org/licenses/LICENSE-2.0)