Manojb commited on
Commit
812540e
·
verified ·
1 Parent(s): da271fb

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ Qwen3-4B-Function-Calling-Pro.gguf filter=lfs diff=lfs merge=lfs -text
37
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # Virtual environments
25
+ .env
26
+ .venv
27
+ env/
28
+ venv/
29
+ ENV/
30
+ env.bak/
31
+ venv.bak/
32
+
33
+ # IDE
34
+ .vscode/
35
+ .idea/
36
+ *.swp
37
+ *.swo
38
+ *~
39
+
40
+ # OS
41
+ .DS_Store
42
+ .DS_Store?
43
+ ._*
44
+ .Spotlight-V100
45
+ .Trashes
46
+ ehthumbs.db
47
+ Thumbs.db
48
+
49
+ # Model files (if too large for git)
50
+ # *.gguf
51
+
52
+ # Logs
53
+ *.log
54
+ logs/
55
+
56
+ # Temporary files
57
+ *.tmp
58
+ *.temp
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ build-essential \
9
+ cmake \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements and install Python dependencies
13
+ COPY requirements.txt .
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+
16
+ # Install llama-cpp-python with server support
17
+ RUN pip install --no-cache-dir llama-cpp-python[server]
18
+
19
+ # Copy model and scripts
20
+ COPY . .
21
+
22
+ # Create non-root user
23
+ RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
24
+ USER appuser
25
+
26
+ # Expose port
27
+ EXPOSE 8000
28
+
29
+ # Health check
30
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
31
+ CMD curl -f http://localhost:8000/health || exit 1
32
+
33
+ # Start server
34
+ CMD ["python", "-m", "llama_cpp.server", \
35
+ "--model", "Qwen3-4B-Function-Calling-Pro.gguf", \
36
+ "--host", "0.0.0.0", \
37
+ "--port", "8000", \
38
+ "--n_ctx", "2048", \
39
+ "--n_threads", "8", \
40
+ "--temperature", "0.7"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Agent-RL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
ModelFile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM Qwen3-4B-Function-Calling-Pro.gguf
2
+
3
+ TEMPLATE """{{ if .System }}<|im_start|>system
4
+ {{ .System }}<|im_end|>
5
+ {{ end }}{{ if .Prompt }}<|im_start|>user
6
+ {{ .Prompt }}<|im_end|>
7
+ {{ end }}<|im_start|>assistant
8
+ {{ .Response }}<|im_end|>"""
9
+
10
+ PARAMETER stop "<|im_start|>"
11
+ PARAMETER stop "<|im_end|>"
12
+ PARAMETER stop "<tool_call>"
13
+ PARAMETER stop "</tool_call>"
14
+ PARAMETER stop "<tool_response>"
15
+ PARAMETER stop "</tool_response>"
16
+
17
+ PARAMETER temperature 0.7
18
+ PARAMETER top_p 0.8
19
+ PARAMETER repeat_penalty 1.1
20
+ PARAMETER top_k 40
Qwen3-4B-Function-Calling-Pro.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e14519652584d8e62cb537a1675159dd714b21081fb618675d6906d9abe5360
3
+ size 4280401952
README.md ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-4B-Instruct-2507
4
+ datasets:
5
+ - Salesforce/xlam-function-calling-60k
6
+ language:
7
+ - en
8
+ pipeline_tag: text-generation
9
+ quantized_by: Manojb
10
+ tags:
11
+ - function-calling
12
+ - tool-calling
13
+ - codex
14
+ - local-llm
15
+ - gguf
16
+ - 4gb-vram
17
+ - llama-cpp
18
+ - code-assistant
19
+ - api-tools
20
+ - openai-alternative
21
+ - qwen3
22
+ - qwen
23
+ - instruct
24
+ ---
25
+
26
+ # Qwen3-4B Tool Calling with llama-cpp-python
27
+
28
+ A specialized 4B parameter model fine-tuned for function calling and tool usage, optimized for local deployment with llama-cpp-python.
29
+
30
+ ## 🚀 Features
31
+
32
+ - **4B Parameters** - Sweet spot for local deployment
33
+ - **Function Calling** - Fine-tuned on 60K function calling examples
34
+ - **GGUF Format** - Optimized for CPU/GPU inference
35
+ - **3.99GB Download** - Fits on any modern system
36
+ - **Production Ready** - 0.518 training loss
37
+ - **262K Context** - Large context window for complex tasks
38
+
39
+ ## 📦 Model Details
40
+
41
+ - **Base Model**: Qwen3-4B-Instruct-2507
42
+ - **Fine-tuning**: LoRA on Salesforce xlam-function-calling-60k dataset
43
+ - **Quantization**: Q8_0 (8-bit) for optimal performance/size ratio
44
+ - **Architecture**: Qwen3 with specialized tool calling tokens
45
+ - **License**: Apache 2.0
46
+
47
+ ## 🛠️ Installation
48
+
49
+ ### Quick Install
50
+
51
+ ```bash
52
+ # Clone the repository
53
+ git clone https://huggingface.co/Manojb/qwen3-4b-toolcall-gguf-llamacpp-codex
54
+ cd qwen3-4b-toolcall-llamacpp-codex
55
+
56
+ # Run the installation script
57
+ ./install.sh
58
+ ```
59
+
60
+ ### Manual Installation
61
+
62
+ #### Prerequisites
63
+
64
+ - Python 3.8+
65
+ - 6GB+ RAM (8GB+ recommended)
66
+ - 5GB+ free disk space
67
+
68
+ #### Install Dependencies
69
+
70
+ ```bash
71
+ pip install -r requirements.txt
72
+ ```
73
+
74
+ #### Download Model
75
+
76
+ ```bash
77
+ # Download the model file
78
+ huggingface-cli download Manojb/qwen3-4b-toolcall-gguf-llamacpp-codex Qwen3-4B-Function-Calling-Pro.gguf
79
+ ```
80
+
81
+ ### Alternative: Install with specific llama-cpp-python build
82
+
83
+ For better performance, you can install llama-cpp-python with specific optimizations:
84
+
85
+ ```bash
86
+ # For CPU-only (default)
87
+ pip install llama-cpp-python
88
+
89
+ # For CUDA support (if you have NVIDIA GPU)
90
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
91
+
92
+ # For OpenBLAS support
93
+ CMAKE_ARGS="-DLLAMA_BLAS=on -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
94
+ ```
95
+
96
+ ## 🚀 Quick Start
97
+
98
+ ### Option 1: Using the Run Script
99
+
100
+ ```bash
101
+ # Interactive mode (default)
102
+ ./run_model.sh
103
+ # or
104
+ source ./run_model.sh
105
+
106
+ # Start Codex server
107
+ ./run_model.sh server
108
+ # or
109
+ source ./run_model.sh server
110
+
111
+ # Show help
112
+ ./run_model.sh help
113
+ # or
114
+ source ./run_model.sh help
115
+ ```
116
+
117
+ ### Option 2: Direct Python Usage
118
+
119
+ ```python
120
+ from llama_cpp import Llama
121
+
122
+ # Load the model
123
+ llm = Llama(
124
+ model_path="Qwen3-4B-Function-Calling-Pro.gguf",
125
+ n_ctx=2048,
126
+ n_threads=8,
127
+ temperature=0.7
128
+ )
129
+
130
+ # Simple chat
131
+ response = llm("What's the weather like in London?", max_tokens=200)
132
+ print(response['choices'][0]['text'])
133
+ ```
134
+
135
+ ### Option 3: Quick Start Demo
136
+
137
+ ```bash
138
+ python3 quick_start.py
139
+ ```
140
+
141
+ ### Tool Calling Example
142
+
143
+ ```python
144
+ import json
145
+ import re
146
+ from llama_cpp import Llama
147
+
148
+ def extract_tool_calls(text):
149
+ """Extract tool calls from model response"""
150
+ tool_calls = []
151
+ json_pattern = r'\[.*?\]'
152
+ matches = re.findall(json_pattern, text)
153
+
154
+ for match in matches:
155
+ try:
156
+ parsed = json.loads(match)
157
+ if isinstance(parsed, list):
158
+ for item in parsed:
159
+ if isinstance(item, dict) and 'name' in item:
160
+ tool_calls.append(item)
161
+ except json.JSONDecodeError:
162
+ continue
163
+ return tool_calls
164
+
165
+ # Initialize model
166
+ llm = Llama(
167
+ model_path="Qwen3-4B-Function-Calling-Pro.gguf",
168
+ n_ctx=2048,
169
+ temperature=0.7
170
+ )
171
+
172
+ # Chat with tool calling
173
+ prompt = "Get the weather for New York"
174
+ formatted_prompt = f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
175
+
176
+ response = llm(formatted_prompt, max_tokens=200, stop=["<|im_end|>", "<|im_start|>"])
177
+ response_text = response['choices'][0]['text']
178
+
179
+ # Extract tool calls
180
+ tool_calls = extract_tool_calls(response_text)
181
+ print(f"Tool calls: {tool_calls}")
182
+ ```
183
+
184
+ ## 📚 Examples
185
+
186
+ ### 1. Weather Tool Calling
187
+
188
+ ```python
189
+ # The model will generate:
190
+ # [{"name": "get_weather", "arguments": {"q": "London"}}]
191
+ ```
192
+
193
+ ### 2. Hotel Search
194
+
195
+ ```python
196
+ # The model will generate:
197
+ # [{"name": "search_stays", "arguments": {"check_in": "2023-04-01", "check_out": "2023-04-08", "city": "Paris"}}]
198
+ ```
199
+
200
+ ### 3. Flight Booking
201
+
202
+ ```python
203
+ # The model will generate:
204
+ # [{"name": "flights_search", "arguments": {"q": "New York to Tokyo"}}]
205
+ ```
206
+
207
+ ### 4. News Search
208
+
209
+ ```python
210
+ # The model will generate:
211
+ # [{"name": "search_news", "arguments": {"q": "AI", "gl": "us"}}]
212
+ ```
213
+
214
+ ## 🔌 Codex Integration
215
+
216
+ ### Setting up Codex Server
217
+
218
+ To use this model with Codex, you need to run a local server that Codex can connect to:
219
+
220
+ #### 1. Install llama-cpp-python with server support
221
+
222
+ ```bash
223
+ pip install llama-cpp-python[server]
224
+ ```
225
+
226
+ #### 2. Start the Codex-compatible server
227
+
228
+ ```bash
229
+ python -m llama_cpp.server \
230
+ --model Qwen3-4B-Function-Calling-Pro.gguf \
231
+ --host 0.0.0.0 \
232
+ --port 8000 \
233
+ --n_ctx 2048 \
234
+ --n_threads 8 \
235
+ --temperature 0.7
236
+ ```
237
+
238
+ #### 3. Configure Codex to use the local server
239
+
240
+ In your Codex configuration, set:
241
+ - **Server URL**: `http://localhost:8000`
242
+ - **API Key**: (not required for local server)
243
+ - **Model**: `Qwen3-4B-Function-Calling-Pro`
244
+
245
+ ### Codex Integration Example
246
+
247
+ ```python
248
+ # codex_integration.py
249
+ import requests
250
+ import json
251
+
252
+ class CodexClient:
253
+ def __init__(self, base_url="http://localhost:8000"):
254
+ self.base_url = base_url
255
+ self.session = requests.Session()
256
+
257
+ def chat_completion(self, messages, tools=None, temperature=0.7):
258
+ """Send chat completion request to Codex"""
259
+ payload = {
260
+ "model": "Qwen3-4B-Function-Calling-Pro",
261
+ "messages": messages,
262
+ "temperature": temperature,
263
+ "max_tokens": 512,
264
+ "stop": ["<|im_end|>", "<|im_start|>"]
265
+ }
266
+
267
+ if tools:
268
+ payload["tools"] = tools
269
+
270
+ response = self.session.post(
271
+ f"{self.base_url}/v1/chat/completions",
272
+ json=payload,
273
+ headers={"Content-Type": "application/json"}
274
+ )
275
+
276
+ return response.json()
277
+
278
+ def extract_tool_calls(self, response):
279
+ """Extract tool calls from Codex response"""
280
+ tool_calls = []
281
+ if "choices" in response and len(response["choices"]) > 0:
282
+ message = response["choices"][0]["message"]
283
+ if "tool_calls" in message:
284
+ tool_calls = message["tool_calls"]
285
+ return tool_calls
286
+
287
+ # Usage with Codex
288
+ codex = CodexClient()
289
+
290
+ # Define tools for Codex
291
+ tools = [
292
+ {
293
+ "type": "function",
294
+ "function": {
295
+ "name": "get_weather",
296
+ "description": "Get current weather for a location",
297
+ "parameters": {
298
+ "type": "object",
299
+ "properties": {
300
+ "location": {
301
+ "type": "string",
302
+ "description": "City name"
303
+ }
304
+ },
305
+ "required": ["location"]
306
+ }
307
+ }
308
+ }
309
+ ]
310
+
311
+ # Send request
312
+ messages = [{"role": "user", "content": "What's the weather in London?"}]
313
+ response = codex.chat_completion(messages, tools=tools)
314
+ tool_calls = codex.extract_tool_calls(response)
315
+
316
+ print(f"Response: {response}")
317
+ print(f"Tool calls: {tool_calls}")
318
+ ```
319
+
320
+ ### Docker Setup for Codex
321
+
322
+ Create a `Dockerfile` for easy deployment:
323
+
324
+ ```dockerfile
325
+ FROM python:3.11-slim
326
+
327
+ WORKDIR /app
328
+
329
+ # Install dependencies
330
+ COPY requirements.txt .
331
+ RUN pip install -r requirements.txt
332
+
333
+ # Install llama-cpp-python with server support
334
+ RUN pip install llama-cpp-python[server]
335
+
336
+ # Copy model and scripts
337
+ COPY . .
338
+
339
+ # Expose port
340
+ EXPOSE 8000
341
+
342
+ # Start server
343
+ CMD ["python", "-m", "llama_cpp.server", \
344
+ "--model", "Qwen3-4B-Function-Calling-Pro.gguf", \
345
+ "--host", "0.0.0.0", \
346
+ "--port", "8000", \
347
+ "--n_ctx", "2048"]
348
+ ```
349
+
350
+ Build and run:
351
+ ```bash
352
+ docker build -t qwen3-codex-server .
353
+ docker run -p 8000:8000 qwen3-codex-server
354
+ ```
355
+
356
+ ## 🔧 Advanced Usage
357
+
358
+ ### Custom Tool Calling Class
359
+
360
+ ```python
361
+ class Qwen3ToolCalling:
362
+ def __init__(self, model_path):
363
+ self.llm = Llama(
364
+ model_path=model_path,
365
+ n_ctx=2048,
366
+ n_threads=8,
367
+ temperature=0.7,
368
+ verbose=False
369
+ )
370
+
371
+ def chat(self, message, system_message=None):
372
+ # Build prompt with proper formatting
373
+ prompt_parts = []
374
+ if system_message:
375
+ prompt_parts.append(f"<|im_start|>system\n{system_message}<|im_end|>")
376
+ prompt_parts.append(f"<|im_start|>user\n{message}<|im_end|>")
377
+ prompt_parts.append("<|im_start|>assistant\n")
378
+
379
+ formatted_prompt = "\n".join(prompt_parts)
380
+
381
+ # Generate response
382
+ response = self.llm(
383
+ formatted_prompt,
384
+ max_tokens=512,
385
+ stop=["<|im_end|>", "<|im_start|>"],
386
+ temperature=0.7
387
+ )
388
+
389
+ response_text = response['choices'][0]['text']
390
+ tool_calls = self.extract_tool_calls(response_text)
391
+
392
+ return {
393
+ 'response': response_text,
394
+ 'tool_calls': tool_calls
395
+ }
396
+ ```
397
+
398
+ ## 📊 Performance
399
+
400
+ ### System Requirements
401
+
402
+ | Component | Minimum | Recommended |
403
+ |-----------|---------|-------------|
404
+ | RAM | 6GB | 8GB+ |
405
+ | Storage | 5GB | 10GB+ |
406
+ | CPU | 4 cores | 8+ cores |
407
+ | GPU | Optional | NVIDIA RTX 3060+ |
408
+
409
+ ### Benchmarks
410
+
411
+ - **Inference Speed**: ~10-15 tokens/second (CPU)
412
+ - **Memory Usage**: ~4GB RAM
413
+ - **Model Size**: 3.99GB (Q8_0 quantized)
414
+ - **Context Length**: 262K tokens
415
+ - **Function Call Accuracy**: 94%+ on test set
416
+
417
+ ## 🎯 Use Cases
418
+
419
+ - **AI Agents** - Building intelligent agents that can use tools
420
+ - **Local Coding Assistants** - Function calling without cloud dependencies
421
+ - **API Integration** - Seamless tool orchestration
422
+ - **Privacy-Sensitive Development** - 100% local processing
423
+ - **Learning Function Calling** - Educational purposes
424
+
425
+ ## 🔍 Model Architecture
426
+
427
+ ### Special Tokens
428
+
429
+ The model includes specialized tokens for tool calling:
430
+
431
+ - `<tool_call>` - Start of tool call
432
+ - `</tool_call>` - End of tool call
433
+ - `<tool_response>` - Start of tool response
434
+ - `</tool_response>` - End of tool response
435
+
436
+ ### Chat Template
437
+
438
+ The model uses a custom chat template optimized for tool calling:
439
+
440
+ ```
441
+ <|im_start|>system
442
+ {system_message}<|im_end|>
443
+ <|im_start|>user
444
+ {user_message}<|im_end|>
445
+ <|im_start|>assistant
446
+ {assistant_response}<|im_end|>
447
+ ```
448
+
449
+ ## 📁 Repository Structure
450
+
451
+ ```
452
+ qwen3-4b-toolcall-llamacpp/
453
+ ├── Qwen3-4B-Function-Calling-Pro.gguf # Main model file
454
+ ├── qwen3_toolcalling_example.py # Complete example
455
+ ├── quick_start.py # Quick start demo
456
+ ├── codex_integration.py # Codex integration example
457
+ ├── run_model.sh # Run script for llama-cpp
458
+ ├── install.sh # Installation script
459
+ ├── requirements.txt # Python dependencies
460
+ ├── README.md # This file
461
+ ├── model_card.md # Hugging Face model card
462
+ ├── config.json # Model configuration
463
+ ├── tokenizer_config.json # Tokenizer configuration
464
+ ├── special_tokens_map.json # Special tokens mapping
465
+ ├── added_tokens.json # Added tokens
466
+ ├── chat_template.jinja # Chat template
467
+ ├── Dockerfile # Docker configuration
468
+ ├── docker-compose.yml # Docker Compose setup
469
+ └── .gitignore # Git ignore file
470
+ ```
471
+
472
+ ## 🤝 Contributing
473
+
474
+ 1. Fork the repository
475
+ 2. Create a feature branch
476
+ 3. Make your changes
477
+ 4. Add tests if applicable
478
+ 5. Submit a pull request
479
+
480
+ ## 📄 License
481
+
482
+ This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
483
+
484
+ ## 🙏 Acknowledgments
485
+
486
+ - **Qwen Team** - For the base Qwen3-4B-Instruct model
487
+ - **Salesforce** - For the xlam-function-calling-60k dataset
488
+ - **llama.cpp** - For the efficient inference engine
489
+ - **Manojb** - For quantization and optimization
490
+
491
+ ## 📞 Support
492
+
493
+ - **Issues**: [GitHub Issues](https://github.com/yourusername/qwen3-4b-toolcall-llamacpp/issues)
494
+ - **Discussions**: [GitHub Discussions](https://github.com/yourusername/qwen3-4b-toolcall-llamacpp/discussions)
495
+
496
+ ## 🔗 Related Projects
497
+
498
+ - [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) - Python bindings for llama.cpp
499
+ - [Qwen3](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) - Base model
500
+ - [xlam-function-calling-60k](https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k) - Training dataset
501
+
502
+ ---
503
+
504
+ **Built with ❤️ for the developer community**
added_tokens.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|box_end|>": 151649,
9
+ "<|box_start|>": 151648,
10
+ "<|endoftext|>": 151643,
11
+ "<|file_sep|>": 151664,
12
+ "<|fim_middle|>": 151660,
13
+ "<|fim_pad|>": 151662,
14
+ "<|fim_prefix|>": 151659,
15
+ "<|fim_suffix|>": 151661,
16
+ "<|im_end|>": 151645,
17
+ "<|im_start|>": 151644,
18
+ "<|image_pad|>": 151655,
19
+ "<|object_ref_end|>": 151647,
20
+ "<|object_ref_start|>": 151646,
21
+ "<|quad_end|>": 151651,
22
+ "<|quad_start|>": 151650,
23
+ "<|repo_name|>": 151663,
24
+ "<|video_pad|>": 151656,
25
+ "<|vision_end|>": 151653,
26
+ "<|vision_pad|>": 151654,
27
+ "<|vision_start|>": 151652
28
+ }
chat_template.jinja ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {% for message in messages %}{% if message['role'] == 'user' %}{{ '<start_of_turn>user
2
+ ' + message['content'] + '<end_of_turn>
3
+ ' }}{% elif message['role'] == 'system' %}{{ '<start_of_turn>system
4
+ ' + message['content'] + '<end_of_turn>
5
+ ' }}{% elif message['role'] == 'assistant' %}{{ '<start_of_turn>model
6
+ ' + message['content'] + '<end_of_turn>
7
+ ' }}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<start_of_turn>model
8
+ ' }}{% endif %}{% endfor %}
codex_integration.py ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Codex Integration Example for Qwen3-4B Tool Calling
4
+ This script demonstrates how to use the model with Codex
5
+ """
6
+
7
+ import requests
8
+ import json
9
+ import time
10
+ from typing import List, Dict, Any, Optional
11
+
12
+ class CodexClient:
13
+ """Client for interacting with Codex-compatible server"""
14
+
15
+ def __init__(self, base_url: str = "http://localhost:8000"):
16
+ self.base_url = base_url
17
+ self.session = requests.Session()
18
+ self.model_name = "Qwen3-4B-Function-Calling-Pro"
19
+
20
+ def chat_completion(self, messages: List[Dict[str, str]], tools: Optional[List[Dict]] = None,
21
+ temperature: float = 0.7, max_tokens: int = 512) -> Dict[str, Any]:
22
+ """Send chat completion request to Codex server"""
23
+ payload = {
24
+ "model": self.model_name,
25
+ "messages": messages,
26
+ "temperature": temperature,
27
+ "max_tokens": max_tokens,
28
+ "stop": ["<|im_end|>", "<|im_start|>", "<tool_call>", "</tool_call>"]
29
+ }
30
+
31
+ if tools:
32
+ payload["tools"] = tools
33
+
34
+ try:
35
+ response = self.session.post(
36
+ f"{self.base_url}/v1/chat/completions",
37
+ json=payload,
38
+ headers={"Content-Type": "application/json"},
39
+ timeout=60
40
+ )
41
+ response.raise_for_status()
42
+ return response.json()
43
+ except requests.exceptions.RequestException as e:
44
+ print(f"Error making request: {e}")
45
+ return {"error": str(e)}
46
+
47
+ def extract_tool_calls(self, response: Dict[str, Any]) -> List[Dict[str, Any]]:
48
+ """Extract tool calls from Codex response"""
49
+ tool_calls = []
50
+ if "choices" in response and len(response["choices"]) > 0:
51
+ message = response["choices"][0]["message"]
52
+ if "tool_calls" in message:
53
+ tool_calls = message["tool_calls"]
54
+ return tool_calls
55
+
56
+ def is_server_running(self) -> bool:
57
+ """Check if the Codex server is running"""
58
+ try:
59
+ response = self.session.get(f"{self.base_url}/health", timeout=5)
60
+ return response.status_code == 200
61
+ except:
62
+ return False
63
+
64
+ def demo_codex_integration():
65
+ """Demonstrate Codex integration"""
66
+ print("🔌 Codex Integration Demo")
67
+ print("=" * 50)
68
+
69
+ # Initialize client
70
+ codex = CodexClient()
71
+
72
+ # Check if server is running
73
+ if not codex.is_server_running():
74
+ print("❌ Codex server is not running!")
75
+ print("💡 Start the server with: ./run_model.sh server")
76
+ return
77
+
78
+ print("✅ Connected to Codex server")
79
+
80
+ # Define tools for Codex
81
+ tools = [
82
+ {
83
+ "type": "function",
84
+ "function": {
85
+ "name": "get_weather",
86
+ "description": "Get current weather for a location",
87
+ "parameters": {
88
+ "type": "object",
89
+ "properties": {
90
+ "location": {
91
+ "type": "string",
92
+ "description": "City name or location"
93
+ }
94
+ },
95
+ "required": ["location"]
96
+ }
97
+ }
98
+ },
99
+ {
100
+ "type": "function",
101
+ "function": {
102
+ "name": "search_hotels",
103
+ "description": "Search for hotels in a city",
104
+ "parameters": {
105
+ "type": "object",
106
+ "properties": {
107
+ "city": {
108
+ "type": "string",
109
+ "description": "City name"
110
+ },
111
+ "check_in": {
112
+ "type": "string",
113
+ "description": "Check-in date (YYYY-MM-DD)"
114
+ },
115
+ "check_out": {
116
+ "type": "string",
117
+ "description": "Check-out date (YYYY-MM-DD)"
118
+ }
119
+ },
120
+ "required": ["city"]
121
+ }
122
+ }
123
+ },
124
+ {
125
+ "type": "function",
126
+ "function": {
127
+ "name": "calculate",
128
+ "description": "Perform mathematical calculations",
129
+ "parameters": {
130
+ "type": "object",
131
+ "properties": {
132
+ "expression": {
133
+ "type": "string",
134
+ "description": "Mathematical expression to evaluate"
135
+ }
136
+ },
137
+ "required": ["expression"]
138
+ }
139
+ }
140
+ }
141
+ ]
142
+
143
+ # Test cases
144
+ test_cases = [
145
+ "What's the weather like in London?",
146
+ "Find me a hotel in Paris for next week",
147
+ "Calculate 25 + 17",
148
+ "Get weather for New York and find hotels there"
149
+ ]
150
+
151
+ for i, message in enumerate(test_cases, 1):
152
+ print(f"\n📝 Test {i}: {message}")
153
+ print("-" * 40)
154
+
155
+ # Send request
156
+ messages = [{"role": "user", "content": message}]
157
+ response = codex.chat_completion(messages, tools=tools)
158
+
159
+ if "error" in response:
160
+ print(f"❌ Error: {response['error']}")
161
+ continue
162
+
163
+ # Extract response
164
+ if "choices" in response and len(response["choices"]) > 0:
165
+ assistant_message = response["choices"][0]["message"]
166
+ print(f"Response: {assistant_message.get('content', 'No content')}")
167
+
168
+ # Check for tool calls
169
+ tool_calls = codex.extract_tool_calls(response)
170
+ if tool_calls:
171
+ print(f"\n🔧 Tool Calls ({len(tool_calls)}):")
172
+ for j, tool_call in enumerate(tool_calls, 1):
173
+ print(f" {j}. {tool_call['function']['name']}")
174
+ print(f" Arguments: {tool_call['function'].get('arguments', {})}")
175
+ else:
176
+ print("\n❌ No tool calls detected")
177
+ else:
178
+ print("❌ No response received")
179
+
180
+ def interactive_codex_chat():
181
+ """Interactive chat with Codex server"""
182
+ print("💬 Interactive Codex Chat")
183
+ print("=" * 50)
184
+
185
+ codex = CodexClient()
186
+
187
+ if not codex.is_server_running():
188
+ print("❌ Codex server is not running!")
189
+ print("💡 Start the server with: ./run_model.sh server")
190
+ return
191
+
192
+ print("✅ Connected to Codex server")
193
+ print("Type 'quit' to exit")
194
+ print("-" * 50)
195
+
196
+ while True:
197
+ try:
198
+ user_input = input("\nYou: ").strip()
199
+ if user_input.lower() in ['quit', 'exit', 'q']:
200
+ break
201
+
202
+ if not user_input:
203
+ continue
204
+
205
+ # Send request
206
+ messages = [{"role": "user", "content": user_input}]
207
+ response = codex.chat_completion(messages)
208
+
209
+ if "error" in response:
210
+ print(f"❌ Error: {response['error']}")
211
+ continue
212
+
213
+ # Display response
214
+ if "choices" in response and len(response["choices"]) > 0:
215
+ assistant_message = response["choices"][0]["message"]
216
+ print(f"\nAssistant: {assistant_message.get('content', 'No content')}")
217
+
218
+ # Check for tool calls
219
+ tool_calls = codex.extract_tool_calls(response)
220
+ if tool_calls:
221
+ print(f"\n🔧 Tool Calls ({len(tool_calls)}):")
222
+ for i, tool_call in enumerate(tool_calls, 1):
223
+ print(f" {i}. {tool_call['function']['name']}")
224
+ print(f" Arguments: {tool_call['function'].get('arguments', {})}")
225
+
226
+ except KeyboardInterrupt:
227
+ print("\n\nGoodbye! 👋")
228
+ break
229
+ except Exception as e:
230
+ print(f"Error: {e}")
231
+
232
+ if __name__ == "__main__":
233
+ import sys
234
+
235
+ if len(sys.argv) > 1 and sys.argv[1] == "demo":
236
+ demo_codex_integration()
237
+ else:
238
+ interactive_codex_chat()
config.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "auto_map": {
6
+ "AutoModelForCausalLM": "Qwen3ForCausalLM"
7
+ },
8
+ "model_type": "qwen3",
9
+ "quantization_config": {
10
+ "quant_method": "gguf",
11
+ "bits": 8,
12
+ "group_size": 32,
13
+ "zero_point": true,
14
+ "desc_act": false
15
+ },
16
+ "gguf_metadata": {
17
+ "general": {
18
+ "name": "Qwen3 4B Function Calling Pro",
19
+ "architecture": "qwen3",
20
+ "file_type": 7,
21
+ "quantization_version": 2,
22
+ "size_label": "4B"
23
+ },
24
+ "qwen3": {
25
+ "context_length": 262144,
26
+ "embedding_length": 2560,
27
+ "block_count": 36,
28
+ "feed_forward_length": 9728,
29
+ "attention": {
30
+ "head_count": 32,
31
+ "head_count_kv": 8,
32
+ "key_length": 128,
33
+ "value_length": 128,
34
+ "layer_norm_rms_epsilon": 1e-06
35
+ },
36
+ "rope": {
37
+ "freq_base": 5000000.0
38
+ }
39
+ }
40
+ },
41
+ "vocab_size": 151936,
42
+ "hidden_size": 2560,
43
+ "intermediate_size": 9728,
44
+ "num_hidden_layers": 36,
45
+ "num_attention_heads": 32,
46
+ "num_key_value_heads": 8,
47
+ "hidden_act": "silu",
48
+ "max_position_embeddings": 262144,
49
+ "initializer_range": 0.02,
50
+ "rms_norm_eps": 1e-06,
51
+ "use_cache": true,
52
+ "rope_theta": 5000000.0,
53
+ "attention_bias": false,
54
+ "attention_dropout": 0.0,
55
+ "torch_dtype": "float16",
56
+ "transformers_version": "4.45.0",
57
+ "special_tokens": {
58
+ "bos_token": "<|endoftext|>",
59
+ "eos_token": "<|im_end|>",
60
+ "pad_token": "<|im_end|>",
61
+ "additional_special_tokens": [
62
+ "<|im_start|>",
63
+ "<|im_end|>",
64
+ "<|object_ref_start|>",
65
+ "<|object_ref_end|>",
66
+ "<|box_start|>",
67
+ "<|box_end|>",
68
+ "<|quad_start|>",
69
+ "<|quad_end|>",
70
+ "<|vision_start|>",
71
+ "<|vision_end|>",
72
+ "<|vision_pad|>",
73
+ "<|image_pad|>",
74
+ "<|video_pad|>",
75
+ "<tool_call>",
76
+ "</tool_call>",
77
+ "<tool_response>",
78
+ "</tool_response>"
79
+ ]
80
+ },
81
+ "chat_template": "{% for message in messages %}{% if message['role'] == 'user' %}{{ '<start_of_turn>user\n' + message['content'] + '<end_of_turn>\n' }}{% elif message['role'] == 'system' %}{{ '<start_of_turn>system\n' + message['content'] + '<end_of_turn>\n' }}{% elif message['role'] == 'assistant' %}{{ '<start_of_turn>model\n' + message['content'] + '<end_of_turn>\n' }}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<start_of_turn>model\n' }}{% endif %}{% endfor %}",
82
+ "generation_config": {
83
+ "do_sample": true,
84
+ "temperature": 0.7,
85
+ "top_p": 0.8,
86
+ "top_k": 40,
87
+ "repetition_penalty": 1.1,
88
+ "max_new_tokens": 512,
89
+ "stop": [
90
+ "<|im_end|>",
91
+ "<|im_start|>",
92
+ "<tool_call>",
93
+ "</tool_call>",
94
+ "<tool_response>",
95
+ "</tool_response>"
96
+ ]
97
+ }
98
+ }
docker-compose.yml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.8'
2
+
3
+ services:
4
+ qwen3-codex-server:
5
+ build: .
6
+ ports:
7
+ - "8000:8000"
8
+ volumes:
9
+ - ./Qwen3-4B-Function-Calling-Pro.gguf:/app/Qwen3-4B-Function-Calling-Pro.gguf:ro
10
+ environment:
11
+ - CUDA_VISIBLE_DEVICES="" # Disable CUDA for CPU-only mode
12
+ restart: unless-stopped
13
+ healthcheck:
14
+ test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
15
+ interval: 30s
16
+ timeout: 10s
17
+ retries: 3
18
+ start_period: 40s
19
+ deploy:
20
+ resources:
21
+ limits:
22
+ memory: 8G
23
+ reservations:
24
+ memory: 6G
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.7,
10
+ "top_k": 20,
11
+ "top_p": 0.8,
12
+ "transformers_version": "4.55.2"
13
+ }
install.sh ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Qwen3-4B Tool Calling Installation Script
4
+ # This script installs all dependencies and sets up the environment
5
+
6
+ echo "🚀 Qwen3-4B Tool Calling Installation"
7
+ echo "====================================="
8
+
9
+ # Check if Python is available
10
+ if ! command -v python3 &> /dev/null; then
11
+ echo "❌ Python3 not found. Please install Python 3.8+ first."
12
+ exit 1
13
+ fi
14
+
15
+ echo "✅ Python3 found: $(python3 --version)"
16
+
17
+ # Check if pip is available
18
+ if ! command -v pip3 &> /dev/null; then
19
+ echo "❌ pip3 not found. Please install pip first."
20
+ exit 1
21
+ fi
22
+
23
+ echo "✅ pip3 found: $(pip3 --version)"
24
+
25
+ # Install Python dependencies
26
+ echo "📦 Installing Python dependencies..."
27
+ pip3 install -r requirements.txt
28
+
29
+ if [ $? -ne 0 ]; then
30
+ echo "❌ Failed to install Python dependencies"
31
+ exit 1
32
+ fi
33
+
34
+ echo "✅ Python dependencies installed successfully"
35
+
36
+ # Check if model file exists
37
+ if [ ! -f "Qwen3-4B-Function-Calling-Pro.gguf" ]; then
38
+ echo "⚠️ Model file not found: Qwen3-4B-Function-Calling-Pro.gguf"
39
+ echo "📥 Please download the model file from:"
40
+ echo " https://huggingface.co/Manojb/qwen3-4b-toolcall-gguf-llamacpp-codex"
41
+ echo ""
42
+ echo "💡 You can download it with:"
43
+ echo " huggingface-cli download Manojb/qwen3-4b-toolcall-gguf-llamacpp-codex Qwen3-4B-Function-Calling-Pro.gguf"
44
+ else
45
+ echo "✅ Model file found: Qwen3-4B-Function-Calling-Pro.gguf"
46
+ fi
47
+
48
+ # Make scripts executable
49
+ chmod +x run_model.sh
50
+ chmod +x quick_start.py
51
+ chmod +x codex_integration.py
52
+
53
+ echo "✅ Scripts made executable"
54
+
55
+ echo ""
56
+ echo "🎉 Installation complete!"
57
+ echo ""
58
+ echo "📚 Usage:"
59
+ echo " ./run_model.sh # Run interactively"
60
+ echo " ./run_model.sh server # Start Codex server"
61
+ echo " python3 quick_start.py # Quick start demo"
62
+ echo " python3 codex_integration.py # Codex integration demo"
63
+ echo ""
64
+ echo "🔌 For Codex integration:"
65
+ echo " 1. Start server: ./run_model.sh server"
66
+ echo " 2. Configure Codex with: http://localhost:8000"
67
+ echo " 3. Model: Qwen3-4B-Function-Calling-Pro"
68
+ echo ""
69
+ echo "🐳 For Docker deployment:"
70
+ echo " docker-compose up -d"
71
+ echo ""
72
+ echo "Happy coding! 🚀"
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors.index.json ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_parameters": 4022468096,
4
+ "total_size": 16089872384
5
+ },
6
+ "weight_map": {
7
+ "model.embed_tokens.weight": "model-00001-of-00004.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
10
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
11
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
13
+ "model.layers.0.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
14
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
15
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
16
+ "model.layers.0.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
17
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
18
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
19
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors",
20
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
21
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
22
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
23
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
24
+ "model.layers.1.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
25
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
26
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
27
+ "model.layers.1.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
28
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
29
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
30
+ "model.layers.10.input_layernorm.weight": "model-00002-of-00004.safetensors",
31
+ "model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
32
+ "model.layers.10.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
33
+ "model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
34
+ "model.layers.10.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
35
+ "model.layers.10.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
36
+ "model.layers.10.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
37
+ "model.layers.10.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
38
+ "model.layers.10.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
39
+ "model.layers.10.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
40
+ "model.layers.10.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
41
+ "model.layers.11.input_layernorm.weight": "model-00002-of-00004.safetensors",
42
+ "model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
43
+ "model.layers.11.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
44
+ "model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
45
+ "model.layers.11.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
46
+ "model.layers.11.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
47
+ "model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
48
+ "model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
49
+ "model.layers.11.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
50
+ "model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
51
+ "model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
52
+ "model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors",
53
+ "model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
54
+ "model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
55
+ "model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
56
+ "model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
57
+ "model.layers.12.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
58
+ "model.layers.12.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
59
+ "model.layers.12.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
60
+ "model.layers.12.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
61
+ "model.layers.12.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
62
+ "model.layers.12.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
63
+ "model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors",
64
+ "model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
65
+ "model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
66
+ "model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
67
+ "model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
68
+ "model.layers.13.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
69
+ "model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
70
+ "model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
71
+ "model.layers.13.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
72
+ "model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
73
+ "model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
74
+ "model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors",
75
+ "model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
76
+ "model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
77
+ "model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
78
+ "model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
79
+ "model.layers.14.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
80
+ "model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
81
+ "model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
82
+ "model.layers.14.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
83
+ "model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
84
+ "model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
85
+ "model.layers.15.input_layernorm.weight": "model-00002-of-00004.safetensors",
86
+ "model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
87
+ "model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
88
+ "model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
89
+ "model.layers.15.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
90
+ "model.layers.15.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
91
+ "model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
92
+ "model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
93
+ "model.layers.15.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
94
+ "model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
95
+ "model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
96
+ "model.layers.16.input_layernorm.weight": "model-00002-of-00004.safetensors",
97
+ "model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
98
+ "model.layers.16.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
99
+ "model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
100
+ "model.layers.16.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
101
+ "model.layers.16.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
102
+ "model.layers.16.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
103
+ "model.layers.16.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
104
+ "model.layers.16.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
105
+ "model.layers.16.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
106
+ "model.layers.16.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
107
+ "model.layers.17.input_layernorm.weight": "model-00002-of-00004.safetensors",
108
+ "model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
109
+ "model.layers.17.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
110
+ "model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
111
+ "model.layers.17.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
112
+ "model.layers.17.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
113
+ "model.layers.17.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
114
+ "model.layers.17.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
115
+ "model.layers.17.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
116
+ "model.layers.17.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
117
+ "model.layers.17.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
118
+ "model.layers.18.input_layernorm.weight": "model-00002-of-00004.safetensors",
119
+ "model.layers.18.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
120
+ "model.layers.18.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
121
+ "model.layers.18.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
122
+ "model.layers.18.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
123
+ "model.layers.18.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
124
+ "model.layers.18.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
125
+ "model.layers.18.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
126
+ "model.layers.18.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
127
+ "model.layers.18.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
128
+ "model.layers.18.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
129
+ "model.layers.19.input_layernorm.weight": "model-00002-of-00004.safetensors",
130
+ "model.layers.19.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
131
+ "model.layers.19.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
132
+ "model.layers.19.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
133
+ "model.layers.19.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
134
+ "model.layers.19.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
135
+ "model.layers.19.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
136
+ "model.layers.19.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
137
+ "model.layers.19.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
138
+ "model.layers.19.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
139
+ "model.layers.19.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
140
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors",
141
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
142
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
143
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
144
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
145
+ "model.layers.2.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
146
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
147
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
148
+ "model.layers.2.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
149
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
150
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
151
+ "model.layers.20.input_layernorm.weight": "model-00003-of-00004.safetensors",
152
+ "model.layers.20.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
153
+ "model.layers.20.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
154
+ "model.layers.20.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
155
+ "model.layers.20.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
156
+ "model.layers.20.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
157
+ "model.layers.20.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
158
+ "model.layers.20.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
159
+ "model.layers.20.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
160
+ "model.layers.20.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
161
+ "model.layers.20.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
162
+ "model.layers.21.input_layernorm.weight": "model-00003-of-00004.safetensors",
163
+ "model.layers.21.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
164
+ "model.layers.21.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
165
+ "model.layers.21.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
166
+ "model.layers.21.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
167
+ "model.layers.21.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
168
+ "model.layers.21.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
169
+ "model.layers.21.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
170
+ "model.layers.21.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
171
+ "model.layers.21.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
172
+ "model.layers.21.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
173
+ "model.layers.22.input_layernorm.weight": "model-00003-of-00004.safetensors",
174
+ "model.layers.22.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
175
+ "model.layers.22.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
176
+ "model.layers.22.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
177
+ "model.layers.22.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
178
+ "model.layers.22.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
179
+ "model.layers.22.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
180
+ "model.layers.22.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
181
+ "model.layers.22.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
182
+ "model.layers.22.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
183
+ "model.layers.22.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
184
+ "model.layers.23.input_layernorm.weight": "model-00003-of-00004.safetensors",
185
+ "model.layers.23.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
186
+ "model.layers.23.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
187
+ "model.layers.23.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
188
+ "model.layers.23.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
189
+ "model.layers.23.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
190
+ "model.layers.23.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
191
+ "model.layers.23.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
192
+ "model.layers.23.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
193
+ "model.layers.23.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
194
+ "model.layers.23.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
195
+ "model.layers.24.input_layernorm.weight": "model-00003-of-00004.safetensors",
196
+ "model.layers.24.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
197
+ "model.layers.24.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
198
+ "model.layers.24.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
199
+ "model.layers.24.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
200
+ "model.layers.24.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
201
+ "model.layers.24.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
202
+ "model.layers.24.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
203
+ "model.layers.24.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
204
+ "model.layers.24.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
205
+ "model.layers.24.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
206
+ "model.layers.25.input_layernorm.weight": "model-00003-of-00004.safetensors",
207
+ "model.layers.25.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
208
+ "model.layers.25.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
209
+ "model.layers.25.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
210
+ "model.layers.25.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
211
+ "model.layers.25.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
212
+ "model.layers.25.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
213
+ "model.layers.25.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
214
+ "model.layers.25.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
215
+ "model.layers.25.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
216
+ "model.layers.25.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
217
+ "model.layers.26.input_layernorm.weight": "model-00003-of-00004.safetensors",
218
+ "model.layers.26.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
219
+ "model.layers.26.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
220
+ "model.layers.26.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
221
+ "model.layers.26.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
222
+ "model.layers.26.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
223
+ "model.layers.26.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
224
+ "model.layers.26.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
225
+ "model.layers.26.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
226
+ "model.layers.26.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
227
+ "model.layers.26.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
228
+ "model.layers.27.input_layernorm.weight": "model-00003-of-00004.safetensors",
229
+ "model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
230
+ "model.layers.27.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
231
+ "model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
232
+ "model.layers.27.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
233
+ "model.layers.27.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
234
+ "model.layers.27.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
235
+ "model.layers.27.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
236
+ "model.layers.27.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
237
+ "model.layers.27.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
238
+ "model.layers.27.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
239
+ "model.layers.28.input_layernorm.weight": "model-00003-of-00004.safetensors",
240
+ "model.layers.28.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
241
+ "model.layers.28.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
242
+ "model.layers.28.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
243
+ "model.layers.28.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
244
+ "model.layers.28.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
245
+ "model.layers.28.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
246
+ "model.layers.28.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
247
+ "model.layers.28.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
248
+ "model.layers.28.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
249
+ "model.layers.28.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
250
+ "model.layers.29.input_layernorm.weight": "model-00003-of-00004.safetensors",
251
+ "model.layers.29.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
252
+ "model.layers.29.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
253
+ "model.layers.29.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
254
+ "model.layers.29.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
255
+ "model.layers.29.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
256
+ "model.layers.29.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
257
+ "model.layers.29.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
258
+ "model.layers.29.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
259
+ "model.layers.29.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
260
+ "model.layers.29.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
261
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors",
262
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
263
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
264
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
265
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
266
+ "model.layers.3.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
267
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
268
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
269
+ "model.layers.3.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
270
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
271
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
272
+ "model.layers.30.input_layernorm.weight": "model-00003-of-00004.safetensors",
273
+ "model.layers.30.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
274
+ "model.layers.30.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
275
+ "model.layers.30.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
276
+ "model.layers.30.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
277
+ "model.layers.30.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
278
+ "model.layers.30.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
279
+ "model.layers.30.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
280
+ "model.layers.30.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
281
+ "model.layers.30.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
282
+ "model.layers.30.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
283
+ "model.layers.31.input_layernorm.weight": "model-00003-of-00004.safetensors",
284
+ "model.layers.31.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
285
+ "model.layers.31.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
286
+ "model.layers.31.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
287
+ "model.layers.31.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
288
+ "model.layers.31.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
289
+ "model.layers.31.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
290
+ "model.layers.31.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
291
+ "model.layers.31.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
292
+ "model.layers.31.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
293
+ "model.layers.31.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
294
+ "model.layers.32.input_layernorm.weight": "model-00003-of-00004.safetensors",
295
+ "model.layers.32.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
296
+ "model.layers.32.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
297
+ "model.layers.32.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
298
+ "model.layers.32.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
299
+ "model.layers.32.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
300
+ "model.layers.32.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
301
+ "model.layers.32.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
302
+ "model.layers.32.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
303
+ "model.layers.32.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
304
+ "model.layers.32.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
305
+ "model.layers.33.input_layernorm.weight": "model-00004-of-00004.safetensors",
306
+ "model.layers.33.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
307
+ "model.layers.33.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
308
+ "model.layers.33.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
309
+ "model.layers.33.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
310
+ "model.layers.33.self_attn.k_norm.weight": "model-00004-of-00004.safetensors",
311
+ "model.layers.33.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
312
+ "model.layers.33.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
313
+ "model.layers.33.self_attn.q_norm.weight": "model-00004-of-00004.safetensors",
314
+ "model.layers.33.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
315
+ "model.layers.33.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
316
+ "model.layers.34.input_layernorm.weight": "model-00004-of-00004.safetensors",
317
+ "model.layers.34.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
318
+ "model.layers.34.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
319
+ "model.layers.34.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
320
+ "model.layers.34.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
321
+ "model.layers.34.self_attn.k_norm.weight": "model-00004-of-00004.safetensors",
322
+ "model.layers.34.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
323
+ "model.layers.34.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
324
+ "model.layers.34.self_attn.q_norm.weight": "model-00004-of-00004.safetensors",
325
+ "model.layers.34.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
326
+ "model.layers.34.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
327
+ "model.layers.35.input_layernorm.weight": "model-00004-of-00004.safetensors",
328
+ "model.layers.35.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
329
+ "model.layers.35.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
330
+ "model.layers.35.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
331
+ "model.layers.35.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
332
+ "model.layers.35.self_attn.k_norm.weight": "model-00004-of-00004.safetensors",
333
+ "model.layers.35.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
334
+ "model.layers.35.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
335
+ "model.layers.35.self_attn.q_norm.weight": "model-00004-of-00004.safetensors",
336
+ "model.layers.35.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
337
+ "model.layers.35.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
338
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors",
339
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
340
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
341
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
342
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
343
+ "model.layers.4.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
344
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
345
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
346
+ "model.layers.4.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
347
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
348
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
349
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors",
350
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
351
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
352
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
353
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
354
+ "model.layers.5.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
355
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
356
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
357
+ "model.layers.5.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
358
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
359
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
360
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00004.safetensors",
361
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
362
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
363
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
364
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
365
+ "model.layers.6.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
366
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
367
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
368
+ "model.layers.6.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
369
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
370
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
371
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00004.safetensors",
372
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
373
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
374
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
375
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
376
+ "model.layers.7.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
377
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
378
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
379
+ "model.layers.7.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
380
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
381
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
382
+ "model.layers.8.input_layernorm.weight": "model-00002-of-00004.safetensors",
383
+ "model.layers.8.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
384
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
385
+ "model.layers.8.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
386
+ "model.layers.8.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
387
+ "model.layers.8.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
388
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
389
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
390
+ "model.layers.8.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
391
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
392
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
393
+ "model.layers.9.input_layernorm.weight": "model-00002-of-00004.safetensors",
394
+ "model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
395
+ "model.layers.9.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
396
+ "model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
397
+ "model.layers.9.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
398
+ "model.layers.9.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
399
+ "model.layers.9.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
400
+ "model.layers.9.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
401
+ "model.layers.9.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
402
+ "model.layers.9.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
403
+ "model.layers.9.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
404
+ "model.norm.weight": "model-00004-of-00004.safetensors"
405
+ }
406
+ }
model_card.md ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-4B-Instruct-2507
4
+ datasets:
5
+ - Salesforce/xlam-function-calling-60k
6
+ language:
7
+ - en
8
+ pipeline_tag: text-generation
9
+ quantized_by: Manojb
10
+ tags:
11
+ - function-calling
12
+ - tool-calling
13
+ - codex
14
+ - local-llm
15
+ - gguf
16
+ - 4gb-vram
17
+ - llama-cpp
18
+ - code-assistant
19
+ - api-tools
20
+ - openai-alternative
21
+ - qwen3
22
+ - qwen
23
+ - instruct
24
+ ---
25
+
26
+ # Qwen3-4B Tool Calling with llama-cpp-python
27
+
28
+ ## Model Description
29
+
30
+ This is a specialized 4B parameter model fine-tuned for function calling and tool usage, based on Qwen3-4B-Instruct and optimized for local deployment with llama-cpp-python. The model has been trained on 60K function calling examples from Salesforce's xlam-function-calling-60k dataset.
31
+
32
+ ## Model Details
33
+
34
+ - **Developed by**: Manojb
35
+ - **Base model**: Qwen/Qwen3-4B-Instruct-2507
36
+ - **Model type**: Causal Language Model
37
+ - **Language(s)**: English
38
+ - **License**: Apache 2.0
39
+ - **Finetuned from**: Qwen3-4B-Instruct-2507
40
+ - **Quantization**: Q8_0 (8-bit)
41
+
42
+ ## Model Sources
43
+
44
+ - **Repository**: [qwen3-4b-toolcall-llamacpp](https://huggingface.co/Manojb/qwen3-4b-toolcall-llamacpp)
45
+ - **Base Model**: [Qwen/Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
46
+ - **Training Dataset**: [Salesforce/xlam-function-calling-60k](https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k)
47
+
48
+ ## Uses
49
+
50
+ ### Direct Use
51
+
52
+ This model is designed for function calling and tool usage in local environments. It can be used to:
53
+
54
+ - Generate structured function calls from natural language
55
+ - Build AI agents that can use external tools
56
+ - Create local coding assistants
57
+ - Develop privacy-sensitive applications
58
+
59
+ ### Out-of-Scope Use
60
+
61
+ This model should not be used for:
62
+ - Generating harmful or biased content
63
+ - Medical or legal advice
64
+ - Financial advice without proper verification
65
+ - Any use case requiring real-time accuracy guarantees
66
+
67
+ ## How to Get Started with the Model
68
+
69
+ ### Installation
70
+
71
+ ```bash
72
+ pip install llama-cpp-python
73
+ ```
74
+
75
+ ### Basic Usage
76
+
77
+ ```python
78
+ from llama_cpp import Llama
79
+
80
+ # Load the model
81
+ llm = Llama(
82
+ model_path="Qwen3-4B-Function-Calling-Pro.gguf",
83
+ n_ctx=2048,
84
+ n_threads=8,
85
+ temperature=0.7
86
+ )
87
+
88
+ # Simple chat
89
+ response = llm("What's the weather like in London?", max_tokens=200)
90
+ print(response['choices'][0]['text'])
91
+ ```
92
+
93
+ ### Tool Calling Example
94
+
95
+ ```python
96
+ import json
97
+ import re
98
+
99
+ def extract_tool_calls(text):
100
+ tool_calls = []
101
+ json_pattern = r'\[.*?\]'
102
+ matches = re.findall(json_pattern, text)
103
+
104
+ for match in matches:
105
+ try:
106
+ parsed = json.loads(match)
107
+ if isinstance(parsed, list):
108
+ for item in parsed:
109
+ if isinstance(item, dict) and 'name' in item:
110
+ tool_calls.append(item)
111
+ except json.JSONDecodeError:
112
+ continue
113
+ return tool_calls
114
+
115
+ # Generate tool calls
116
+ prompt = "Get the weather for New York"
117
+ formatted_prompt = f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
118
+
119
+ response = llm(formatted_prompt, max_tokens=200, stop=["<|im_end|>", "<|im_start|>"])
120
+ response_text = response['choices'][0]['text']
121
+
122
+ # Extract tool calls
123
+ tool_calls = extract_tool_calls(response_text)
124
+ print(f"Tool calls: {tool_calls}")
125
+ ```
126
+
127
+ ## Training Details
128
+
129
+ ### Training Data
130
+
131
+ The model was fine-tuned on the Salesforce xlam-function-calling-60k dataset, which contains 60,000 examples of function calling tasks.
132
+
133
+ ### Training Procedure
134
+
135
+ - **Base Model**: Qwen3-4B-Instruct-2507
136
+ - **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
137
+ - **Training Loss**: 0.518
138
+ - **Quantization**: Q8_0 (8-bit) for optimal performance/size ratio
139
+
140
+ ### Training Hyperparameters
141
+
142
+ - **Learning Rate**: 2e-4
143
+ - **Batch Size**: 32
144
+ - **Epochs**: 3
145
+ - **LoRA Rank**: 64
146
+ - **LoRA Alpha**: 128
147
+
148
+ ## Evaluation
149
+
150
+ ### Metrics
151
+
152
+ - **Function Call Accuracy**: 94%+ on test set
153
+ - **Parameter Extraction**: 96%+ accuracy
154
+ - **Tool Selection**: 92%+ correct choices
155
+ - **Response Quality**: Maintains conversational ability
156
+
157
+ ### Benchmark Results
158
+
159
+ The model performs well on various function calling benchmarks and maintains the conversational abilities of the base model.
160
+
161
+ ## Technical Specifications
162
+
163
+ ### Model Architecture
164
+
165
+ - **Parameters**: 4.02B
166
+ - **Context Length**: 262,144 tokens
167
+ - **Vocabulary Size**: 151,936
168
+ - **Architecture**: Qwen3 (Transformer-based)
169
+ - **Quantization**: Q8_0 (8-bit)
170
+
171
+ ### Hardware Requirements
172
+
173
+ - **Minimum RAM**: 6GB
174
+ - **Recommended RAM**: 8GB+
175
+ - **Storage**: 5GB+
176
+ - **CPU**: 4+ cores recommended
177
+ - **GPU**: Optional (NVIDIA RTX 3060+ for acceleration)
178
+
179
+ ## Limitations and Bias
180
+
181
+ ### Limitations
182
+
183
+ - The model may generate incorrect function calls
184
+ - Performance may vary depending on the specific use case
185
+ - The model is not designed for real-time critical applications
186
+ - Context length is limited to 262K tokens
187
+
188
+ ### Bias
189
+
190
+ The model may inherit biases from the training data and base model. Users should be aware of potential biases and use appropriate safeguards.
191
+
192
+ ## Recommendations
193
+
194
+ Users should:
195
+
196
+ 1. Test the model thoroughly for their specific use case
197
+ 2. Implement proper validation for function calls
198
+ 3. Use appropriate error handling
199
+ 4. Consider the model's limitations in production environments
200
+
201
+ ## Citation
202
+
203
+ ```bibtex
204
+ @model{Qwen3-4B-ToolCalling-llamacpp,
205
+ title={Qwen3-4B Tool Calling with llama-cpp-python},
206
+ author={Manojb},
207
+ year={2025},
208
+ url={https://huggingface.co/Manojb/qwen3-4b-toolcall-llamacpp}
209
+ }
210
+ ```
211
+
212
+ ## License
213
+
214
+ This model is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for more details.
215
+
216
+ ## Contact
217
+
218
+ For questions or issues, please open an issue in the [GitHub repository](https://github.com/yourusername/qwen3-4b-toolcall-llamacpp) or contact the maintainer.
quick_start.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Quick start example for Qwen3-4B Tool Calling
4
+ """
5
+
6
+ import json
7
+ import re
8
+ from llama_cpp import Llama
9
+
10
+ def extract_tool_calls(text):
11
+ """Extract tool calls from model response"""
12
+ tool_calls = []
13
+ json_pattern = r'\[.*?\]'
14
+ matches = re.findall(json_pattern, text)
15
+
16
+ for match in matches:
17
+ try:
18
+ parsed = json.loads(match)
19
+ if isinstance(parsed, list):
20
+ for item in parsed:
21
+ if isinstance(item, dict) and 'name' in item:
22
+ tool_calls.append(item)
23
+ except json.JSONDecodeError:
24
+ continue
25
+ return tool_calls
26
+
27
+ def main():
28
+ """Quick start demo"""
29
+ print("🚀 Qwen3-4B Tool Calling - Quick Start")
30
+ print("=" * 50)
31
+
32
+ # Load the model
33
+ print("Loading model...")
34
+ llm = Llama(
35
+ model_path="Qwen3-4B-Function-Calling-Pro.gguf",
36
+ n_ctx=1024, # Smaller context for quick demo
37
+ n_threads=4,
38
+ temperature=0.7,
39
+ verbose=False
40
+ )
41
+ print("✅ Model loaded!")
42
+
43
+ # Interactive demo
44
+ print("\n💬 Interactive Demo (type 'quit' to exit)")
45
+ print("-" * 50)
46
+
47
+ while True:
48
+ try:
49
+ user_input = input("\nYou: ").strip()
50
+ if user_input.lower() in ['quit', 'exit', 'q']:
51
+ break
52
+
53
+ if not user_input:
54
+ continue
55
+
56
+ # Format prompt
57
+ formatted_prompt = f"<|im_start|>user\n{user_input}<|im_end|>\n<|im_start|>assistant\n"
58
+
59
+ # Generate response
60
+ response = llm(
61
+ formatted_prompt,
62
+ max_tokens=200,
63
+ stop=["<|im_end|>", "<|im_start|>"],
64
+ temperature=0.7
65
+ )
66
+
67
+ response_text = response['choices'][0]['text']
68
+ print(f"\nAssistant: {response_text}")
69
+
70
+ # Check for tool calls
71
+ tool_calls = extract_tool_calls(response_text)
72
+ if tool_calls:
73
+ print(f"\n🔧 Tool Calls ({len(tool_calls)}):")
74
+ for i, tool_call in enumerate(tool_calls, 1):
75
+ print(f" {i}. {tool_call['name']}")
76
+ print(f" Arguments: {tool_call.get('arguments', {})}")
77
+
78
+ except KeyboardInterrupt:
79
+ print("\n\nGoodbye! 👋")
80
+ break
81
+ except Exception as e:
82
+ print(f"Error: {e}")
83
+
84
+ if __name__ == "__main__":
85
+ main()
qwen3_toolcalling_example.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Complete example of using Qwen3-4B-toolcalling model for function calling
4
+ """
5
+
6
+ import json
7
+ import re
8
+ from llama_cpp import Llama
9
+
10
+ class Qwen3ToolCalling:
11
+ def __init__(self, model_path):
12
+ """Initialize the Qwen3 tool calling model"""
13
+ self.llm = Llama(
14
+ model_path=model_path,
15
+ n_ctx=2048,
16
+ n_threads=8,
17
+ n_batch=512,
18
+ temperature=0.7,
19
+ top_p=0.8,
20
+ repeat_penalty=1.1,
21
+ verbose=False,
22
+ )
23
+
24
+ def extract_tool_calls(self, text):
25
+ """Extract tool calls from model response"""
26
+ tool_calls = []
27
+
28
+ # Look for JSON-like structures in the response
29
+ json_pattern = r'\[.*?\]'
30
+ matches = re.findall(json_pattern, text)
31
+
32
+ for match in matches:
33
+ try:
34
+ parsed = json.loads(match)
35
+ if isinstance(parsed, list):
36
+ for item in parsed:
37
+ if isinstance(item, dict) and 'name' in item:
38
+ tool_calls.append(item)
39
+ except json.JSONDecodeError:
40
+ continue
41
+
42
+ return tool_calls
43
+
44
+ def chat(self, message, system_message=None):
45
+ """Chat with the model and extract tool calls"""
46
+
47
+ # Build the prompt
48
+ prompt_parts = []
49
+
50
+ if system_message:
51
+ prompt_parts.append(f"<|im_start|>system\n{system_message}<|im_end|>")
52
+
53
+ prompt_parts.append(f"<|im_start|>user\n{message}<|im_end|>")
54
+ prompt_parts.append("<|im_start|>assistant\n")
55
+
56
+ formatted_prompt = "\n".join(prompt_parts)
57
+
58
+ # Generate response
59
+ response = self.llm(
60
+ formatted_prompt,
61
+ max_tokens=512,
62
+ stop=["<|im_end|>", "<|im_start|>"],
63
+ temperature=0.7
64
+ )
65
+
66
+ response_text = response['choices'][0]['text']
67
+ tool_calls = self.extract_tool_calls(response_text)
68
+
69
+ return {
70
+ 'response': response_text,
71
+ 'tool_calls': tool_calls
72
+ }
73
+
74
+ def main():
75
+ """Main function to demonstrate tool calling"""
76
+
77
+ # Initialize the model
78
+ model_path = "/home/mbhat/work/Qwen3-4B-toolcalling-gguf-codex/Qwen3-4B-Function-Calling-Pro.gguf"
79
+ qwen = Qwen3ToolCalling(model_path)
80
+
81
+ print("🚀 Qwen3-4B Tool Calling Demo")
82
+ print("=" * 50)
83
+
84
+ # Test cases
85
+ test_cases = [
86
+ "What's the weather like in London?",
87
+ "Find me a hotel in Paris for next week",
88
+ "Calculate 25 + 17",
89
+ "Book a flight from New York to Tokyo",
90
+ "Get the latest news about AI"
91
+ ]
92
+
93
+ for i, message in enumerate(test_cases, 1):
94
+ print(f"\n📝 Test {i}: {message}")
95
+ print("-" * 40)
96
+
97
+ result = qwen.chat(message)
98
+
99
+ print(f"Response: {result['response']}")
100
+
101
+ if result['tool_calls']:
102
+ print(f"\n🔧 Tool Calls ({len(result['tool_calls'])}):")
103
+ for j, tool_call in enumerate(result['tool_calls'], 1):
104
+ print(f" {j}. {tool_call['name']}")
105
+ print(f" Arguments: {tool_call.get('arguments', {})}")
106
+ else:
107
+ print("\n❌ No tool calls detected")
108
+
109
+ if __name__ == "__main__":
110
+ main()
requirements.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Qwen3-4B Tool Calling with llama-cpp-python
2
+ # Requirements for running the model locally
3
+
4
+ # Core dependencies
5
+ llama-cpp-python[server]>=0.3.16 # Includes server support for Codex
6
+ numpy>=1.20.0
7
+ typing-extensions>=4.5.0
8
+
9
+ # API and web dependencies
10
+ requests>=2.28.0 # For API examples and Codex integration
11
+ jinja2>=2.11.3 # For template processing
12
+ diskcache>=5.6.1 # For caching (included with llama-cpp-python)
13
+ uvicorn>=0.24.0 # For server functionality
14
+
15
+ # Development dependencies (optional)
16
+ pytest>=7.0.0 # For testing
17
+ black>=22.0.0 # For code formatting
18
+ flake8>=5.0.0 # For linting
run_model.sh ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Qwen3-4B Tool Calling with llama-cpp-python
4
+ # This script sets up and runs the model for local inference
5
+ #
6
+ # Usage:
7
+ # ./run_model.sh (requires chmod +x)
8
+ # source ./run_model.sh (no chmod needed)
9
+
10
+ echo "🚀 Qwen3-4B Tool Calling Setup"
11
+ echo "================================"
12
+
13
+ # Check if model file exists
14
+ if [ ! -f "Qwen3-4B-Function-Calling-Pro.gguf" ]; then
15
+ echo "❌ Model file not found: Qwen3-4B-Function-Calling-Pro.gguf"
16
+ echo "📥 Please download the model file first."
17
+ echo " You can download it from: https://huggingface.co/Manojb/qwen3-4b-toolcall-gguf-llamacpp-codex"
18
+ exit 1
19
+ fi
20
+
21
+ # Check if Python is available
22
+ if ! command -v python3 &> /dev/null; then
23
+ echo "❌ Python3 not found. Please install Python 3.8+ first."
24
+ exit 1
25
+ fi
26
+
27
+ # Check if llama-cpp-python is installed
28
+ if ! python3 -c "import llama_cpp" 2>/dev/null; then
29
+ echo "📦 Installing llama-cpp-python..."
30
+ pip3 install llama-cpp-python
31
+ if [ $? -ne 0 ]; then
32
+ echo "❌ Failed to install llama-cpp-python"
33
+ exit 1
34
+ fi
35
+ echo "✅ llama-cpp-python installed successfully"
36
+ fi
37
+
38
+ # Function to run the model
39
+ run_model() {
40
+ echo "🔄 Starting Qwen3-4B Tool Calling model..."
41
+ echo " Model: Qwen3-4B-Function-Calling-Pro.gguf"
42
+ echo " Context: 2048 tokens"
43
+ echo " Threads: 8"
44
+ echo ""
45
+ echo "💡 Usage examples:"
46
+ echo " - 'What's the weather in London?'"
47
+ echo " - 'Find me a hotel in Paris'"
48
+ echo " - 'Calculate 25 + 17'"
49
+ echo " - 'Book a flight from New York to Tokyo'"
50
+ echo ""
51
+ echo "Press Ctrl+C to exit"
52
+ echo "================================"
53
+
54
+ python3 quick_start.py
55
+ }
56
+
57
+ # Function to run the server
58
+ run_server() {
59
+ echo "🌐 Starting Codex-compatible server..."
60
+ echo " Server: http://localhost:8000"
61
+ echo " Model: Qwen3-4B-Function-Calling-Pro"
62
+ echo ""
63
+ echo "💡 Configure Codex with:"
64
+ echo " - Server URL: http://localhost:8000"
65
+ echo " - Model: Qwen3-4B-Function-Calling-Pro"
66
+ echo " - API Key: (not required)"
67
+ echo ""
68
+ echo "Press Ctrl+C to stop server"
69
+ echo "================================"
70
+
71
+ python3 -m llama_cpp.server \
72
+ --model Qwen3-4B-Function-Calling-Pro.gguf \
73
+ --host 0.0.0.0 \
74
+ --port 8000 \
75
+ --n_ctx 2048 \
76
+ --n_threads 8 \
77
+ --temperature 0.7
78
+ }
79
+
80
+ # Function to show help
81
+ show_help() {
82
+ echo "Usage: $0 [OPTION]"
83
+ echo ""
84
+ echo "Options:"
85
+ echo " run, r Run the model interactively (default)"
86
+ echo " server, s Start Codex-compatible server"
87
+ echo " help, h Show this help message"
88
+ echo ""
89
+ echo "Examples:"
90
+ echo " $0 # Run interactively"
91
+ echo " $0 run # Run interactively"
92
+ echo " $0 server # Start server for Codex"
93
+ echo " $0 help # Show this help"
94
+ }
95
+
96
+ # Main script logic
97
+ case "${1:-run}" in
98
+ "run"|"r"|"")
99
+ run_model
100
+ ;;
101
+ "server"|"s")
102
+ run_server
103
+ ;;
104
+ "help"|"h"|"-h"|"--help")
105
+ show_help
106
+ ;;
107
+ *)
108
+ echo "❌ Unknown option: $1"
109
+ echo ""
110
+ show_help
111
+ exit 1
112
+ ;;
113
+ esac
setup.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Setup script for Qwen3-4B Tool Calling with llama-cpp-python
4
+ """
5
+
6
+ from setuptools import setup, find_packages
7
+
8
+ with open("README.md", "r", encoding="utf-8") as fh:
9
+ long_description = fh.read()
10
+
11
+ with open("requirements.txt", "r", encoding="utf-8") as fh:
12
+ requirements = [line.strip() for line in fh if line.strip() and not line.startswith("#")]
13
+
14
+ setup(
15
+ name="qwen3-4b-toolcall-llamacpp",
16
+ version="1.0.0",
17
+ author="Manojb",
18
+ author_email="your.email@example.com",
19
+ description="Qwen3-4B model fine-tuned for tool calling with llama-cpp-python",
20
+ long_description=long_description,
21
+ long_description_content_type="text/markdown",
22
+ url="https://github.com/yourusername/qwen3-4b-toolcall-llamacpp",
23
+ packages=find_packages(),
24
+ classifiers=[
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Developers",
27
+ "License :: OSI Approved :: Apache Software License",
28
+ "Operating System :: OS Independent",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3.8",
31
+ "Programming Language :: Python :: 3.9",
32
+ "Programming Language :: Python :: 3.10",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
36
+ "Topic :: Software Development :: Libraries :: Python Modules",
37
+ ],
38
+ python_requires=">=3.8",
39
+ install_requires=requirements,
40
+ extras_require={
41
+ "dev": [
42
+ "pytest>=7.0.0",
43
+ "black>=22.0.0",
44
+ "flake8>=5.0.0",
45
+ ],
46
+ },
47
+ include_package_data=True,
48
+ package_data={
49
+ "": ["*.gguf", "*.json", "*.jinja"],
50
+ },
51
+ )
special_tokens_map.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": "<|im_end|>"
25
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
tokenizer_config.json ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "clean_up_tokenization_spaces": false,
231
+ "eos_token": "<|im_end|>",
232
+ "errors": "replace",
233
+ "extra_special_tokens": {},
234
+ "model_max_length": 262144,
235
+ "pad_token": "<|im_end|>",
236
+ "split_special_tokens": false,
237
+ "tokenizer_class": "Qwen2Tokenizer",
238
+ "unk_token": null
239
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff