初始化项目,由ModelHub XC社区提供模型
Model: zwenai13/Zwen-Prime Source: Original Platform
This commit is contained in:
commit
3f07f2fe07
9 files changed
+276071
No files matched your search
@@ -0,0 +1,36 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
Zwen-Prime-Final.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -0,0 +1,156 @@
|
||||
---
|
||||
license: cc-by-nc-4.0
|
||||
language:
|
||||
- en
|
||||
pipeline_tag: text-generation
|
||||
tags:
|
||||
- code
|
||||
- full-stack
|
||||
- mistral
|
||||
- gguf
|
||||
- zwen-ai-labs
|
||||
base_model: mistralai/Mistral-7B-Instruct-v0.3
|
||||
---
|
||||
|
||||
# Zwen-Prime
|
||||
|
||||
*An elite Full-Stack Principal Engineer in a 7B parameter body. Built by Zwen AI Labs.*
|
||||
|
||||
Zwen-Prime is a two-stage model: a DARE-TIES neural fusion of three Mistral-7B-class specialists, followed by a supervised fine-tune on a hand-crafted five-corpus mixture that hard-installs strict `<thinking>` reasoning, Big-O discipline, native JSON function-calling, and zero-filler full-stack output. It is engineered for local inference on Apple Silicon and served via the official `zwen-cli` (with Ollama / llama.cpp as alternatives).
|
||||
|
||||
## Model Summary
|
||||
|
||||
| Feature | Details |
|
||||
| :--- | :--- |
|
||||
| **Creator** | Zwen AI Labs |
|
||||
| **Architecture** | Mistral-7B (DARE-TIES merge + LoRA SFT, fused) |
|
||||
| **Active params** | ~7B |
|
||||
| **Context window** | 32,000 tokens (32k via preserved RoPE scaling) |
|
||||
| **Quantization** | Q4_K_M GGUF (~4.2 GB, < 5 GB RAM target) |
|
||||
| **Hardware target** | Apple Silicon (M-series, Metal-accelerated) |
|
||||
| **Serving** | zwen-cli (official) · Ollama · llama.cpp |
|
||||
| **Languages** | English |
|
||||
|
||||
## The Brain — Five-Corpus Training Mixture
|
||||
|
||||
Zwen-Prime is fine-tuned on a deliberate mixture of five datasets, each installing a distinct cognitive faculty:
|
||||
|
||||
| Corpus | Weight | Faculty installed |
|
||||
| :--- | :--- | :--- |
|
||||
| **Alpaca Python** | 40% | Elite, typed Python and algorithms at correct complexity. |
|
||||
| **Orca Math** | 30% | Deep, step-by-step mathematical reasoning with verified derivation. |
|
||||
| **Salesforce XLAM** | 20% | Flawless, raw-JSON function/tool calling (Mistral v0.3 convention). |
|
||||
| **LongAlpaca** | 10% | Extended-context retention and long-document grounding without drift. |
|
||||
| **Zwen Custom** | core spine | Strict `<thinking>` logic + Big-O breakdown, full-stack mastery (TypeScript, React/Next.js, Java concurrency), absolute zero-filler output. |
|
||||
|
||||
The custom 550-row dataset (`zwen_prime_master_dataset.jsonl`) is the enforcement spine: 50 Identity rows that set the persona and 500 Algorithmic/Logic rows that lock in the `<thinking>...</thinking>` → `raw-code` template across advanced TypeScript generics, React/Next.js App-Router architecture, Java concurrency primitives, and Python system design.
|
||||
|
||||
## Capabilities
|
||||
|
||||
* **Strict reasoning core:** Every non-trivial answer opens a `<thinking>` block with step-by-step logic and a time/space Big-O breakdown, immediately followed by the raw deliverable — no filler, no preamble.
|
||||
* **Full-stack mastery:**
|
||||
* **Python:** typed (PEP 484/604), async-aware, concurrency-correct algorithms.
|
||||
* **TypeScript:** advanced generics, conditional/mapped types, type-stateful builders, discriminated unions.
|
||||
* **React / Next.js:** App Router, RSC, Server Actions, route handlers, caching/revalidation, React 19 hooks, streaming.
|
||||
* **Java:** ReentrantLock, StampedLock, Semaphore, CompletableFuture, ForkJoinPool, virtual threads, happens-before reasoning.
|
||||
* **Native function calling:** Emits `[TOOL_CALLS]` raw JSON matching the provided tool schema; no markdown, no prose around the call.
|
||||
* **Mathematical reasoning:** Derives quantitative claims in the scratchpad before asserting them; sanity-checks units, magnitudes, and boundaries.
|
||||
* **Long-context discipline:** Anchors claims to source passages; refuses to confabulate when evidence is absent.
|
||||
* **Zero conversational filler:** No greetings, sign-offs, apologies, or compliance narration.
|
||||
|
||||
## Merge Details
|
||||
|
||||
### Merge Method
|
||||
The base was produced with the DARE TIES merge method via mergekit, using `Mistral-7B-Instruct-v0.3` as the density-0 reference base.
|
||||
|
||||
### Models Merged
|
||||
* `dphn/dolphin-2.9.3-mistral-7B-32k` — reasoning specialist
|
||||
* `theprint/ReWiz-7B` — fine-tune specialist
|
||||
* `mistralai/Mistral-7B-Instruct-v0.3` — base / reference (density 0, weight 0)
|
||||
|
||||
### Merge Configuration
|
||||
```yaml
|
||||
base_model: mistralai/Mistral-7B-Instruct-v0.3
|
||||
merge_method: dare_ties
|
||||
dtype: bfloat16
|
||||
out_shard_size: 1.2B
|
||||
parameters:
|
||||
density: 0.5
|
||||
weight: 1.0
|
||||
normalize: true
|
||||
int8_mask: true
|
||||
rescale: true
|
||||
lambda: 1.0
|
||||
models:
|
||||
- model: dphn/dolphin-2.9.3-mistral-7B-32k
|
||||
parameters:
|
||||
density: 0.5
|
||||
weight: 1.0
|
||||
- model: theprint/ReWiz-7B
|
||||
parameters:
|
||||
density: 0.5
|
||||
weight: 1.0
|
||||
- model: mistralai/Mistral-7B-Instruct-v0.3
|
||||
parameters:
|
||||
density: 0.0
|
||||
weight: 0.0
|
||||
```
|
||||
|
||||
### Fine-Tune Stage
|
||||
The merged base was then LoRA fine-tuned on the five-corpus mixture and the adapters permanently fused into the base weights (`peft.merge_and_unload`). The fused model is exported to GGUF for local serving.
|
||||
|
||||
```
|
||||
DARE-TIES merge → LoRA SFT (5-corpus mixture) → merge_and_unload → GGUF → Ollama
|
||||
```
|
||||
|
||||
## ChatML-Native Format
|
||||
|
||||
Although the GGUF embeds the Mistral v0.3 chat template, Zwen-Prime's fusion corpus (Dolphin / ReWiz) is **ChatML-formatted**, so the model's native turn format is `<|im_start|>system…<|im_end|><|im_start|>user…`. Under Mistral `[INST]` framing it ignores the user prompt and runs on; under ChatML it reasons cleanly in `<thinking>` and stops on turn boundaries. Both official runtimes therefore pin the ChatML wrapper:
|
||||
|
||||
* **zwen-cli** pins `ChatMLChatWrapper` automatically — no configuration needed.
|
||||
* The **Ollama Modelfile** injects the strict Zwen-Prime system prompt and the ChatML template via its `TEMPLATE`/`SYSTEM` directives.
|
||||
|
||||
The base merge is `dolphin-2.9.3-mistral-7B-32k`, and its 32k RoPE scaling is preserved intact — so Zwen-Prime officially supports a **32,000-token context window**, enough to ingest a large enterprise codebase in a single pass.
|
||||
|
||||
### Serving
|
||||
|
||||
Zwen-Prime is pre-quantized to **Q4_K_M** to run blisteringly fast on Apple Silicon and consumer GPUs (< 5 GB RAM required). The published quant is **`Zwen-Prime-Final.Q4_K_M.gguf`** (~4.2 GB).
|
||||
|
||||
**Official CLI** (recommended) — installs globally and auto-downloads the GGUF into `~/.zwen/models/` on first run, with a 32k context out of the box:
|
||||
|
||||
```
|
||||
npm install -g @zwenailabs13/zwen-cli
|
||||
zwen run zwen-prime
|
||||
zwen chat # interactive REPL
|
||||
zwen list # list cached models in ~/.zwen/models/
|
||||
```
|
||||
|
||||
**Ollama** (alternative) — the Modelfile automatically injects the strict Zwen-Prime system prompt and handles the ChatML formatting:
|
||||
|
||||
```
|
||||
ollama run zwenailabs/zwen-prime
|
||||
```
|
||||
|
||||
**llama.cpp** (manual) — point any ChatML-aware runner at `Zwen-Prime-Final.Q4_K_M.gguf` and supply the Zwen-Prime system prompt.
|
||||
|
||||
## System Prompt
|
||||
Zwen-Prime ships with a dedicated system prompt that sets the Principal-Engineer persona, the `<thinking>` mandate, the zero-filler output protocol, full-stack mastery expectations, native JSON tool-calling rules, long-context discipline, and the hard constraints. It is embedded in the Modelfile's `SYSTEM` directive.
|
||||
|
||||
## Intended Use
|
||||
Zwen-Prime is intended as a local, autonomous engineering copilot: designing and shipping production code across Python, TypeScript, React/Next.js, and Java; reasoning through math and algorithms with verifiable steps; and calling tools via raw JSON when integrated into an agent runtime.
|
||||
|
||||
## Limitations
|
||||
* **7B scale:** Strong on focused engineering tasks; not a frontier-class generalist.
|
||||
* **Wall-clock-sensitive:** Derived math is verified symbolically in-context but not executed; verify numerically when stakes are high.
|
||||
* **Function calling:** Follows the Mistral v0.3 / XLAM JSON convention and expects a tool-aware runtime to dispatch `[TOOL_CALLS]`.
|
||||
* **Behavioral design:** Fine-tuned toward zero-filler directness; users expecting conversational preamble will not get it.
|
||||
|
||||
## License & Commercial Use
|
||||
The weights and architecture of Zwen-Prime are released under the **CC BY-NC 4.0 (Creative Commons Non-Commercial)** license.
|
||||
|
||||
* **Free for Developers:** Individual developers, researchers, and hobbyists are fully encouraged to download, run, and modify Zwen-Prime locally for free.
|
||||
* **Commercial Restrictions:** Cloud hosting, API provisioning, enterprise internal deployments, and any form of commercial reselling are strictly prohibited under this license.
|
||||
* **Enterprise Licensing:** For commercial deployment, managed hosting, or enterprise use, you must acquire a commercial license through Axora.
|
||||
|
||||
Visit: https://axoraio.in
|
||||
Email: contact@axoraio.in
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5fffa9a5dd497928d1f10d5add1de9e91e68b70fea8460ff9dc1fa416eca6bc4
|
||||
size 4372815648
|
||||
@@ -0,0 +1,87 @@
|
||||
{%- if messages[0]["role"] == "system" %}
|
||||
{%- set system_message = messages[0]["content"] %}
|
||||
{%- set loop_messages = messages[1:] %}
|
||||
{%- else %}
|
||||
{%- set loop_messages = messages %}
|
||||
{%- endif %}
|
||||
{%- if not tools is defined %}
|
||||
{%- set tools = none %}
|
||||
{%- endif %}
|
||||
{%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
|
||||
|
||||
{#- This block checks for alternating user/assistant messages, skipping tool calling messages #}
|
||||
{%- set ns = namespace() %}
|
||||
{%- set ns.index = 0 %}
|
||||
{%- for message in loop_messages %}
|
||||
{%- if not (message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %}
|
||||
{%- if (message["role"] == "user") != (ns.index % 2 == 0) %}
|
||||
{{- raise_exception("After the optional system message, conversation roles must alternate user/assistant/user/assistant/...") }}
|
||||
{%- endif %}
|
||||
{%- set ns.index = ns.index + 1 %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{{- bos_token }}
|
||||
{%- for message in loop_messages %}
|
||||
{%- if message["role"] == "user" %}
|
||||
{%- if tools is not none and (message == user_messages[-1]) %}
|
||||
{{- "[AVAILABLE_TOOLS] [" }}
|
||||
{%- for tool in tools %}
|
||||
{%- set tool = tool.function %}
|
||||
{{- '{"type": "function", "function": {' }}
|
||||
{%- for key, val in tool.items() if key != "return" %}
|
||||
{%- if val is string %}
|
||||
{{- '"' + key + '": "' + val + '"' }}
|
||||
{%- else %}
|
||||
{{- '"' + key + '": ' + val|tojson }}
|
||||
{%- endif %}
|
||||
{%- if not loop.last %}
|
||||
{{- ", " }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- "}}" }}
|
||||
{%- if not loop.last %}
|
||||
{{- ", " }}
|
||||
{%- else %}
|
||||
{{- "]" }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- "[/AVAILABLE_TOOLS]" }}
|
||||
{%- endif %}
|
||||
{%- if loop.last and system_message is defined %}
|
||||
{{- "[INST] " + system_message + "\n\n" + message["content"] + "[/INST]" }}
|
||||
{%- else %}
|
||||
{{- "[INST] " + message["content"] + "[/INST]" }}
|
||||
{%- endif %}
|
||||
{%- elif message.tool_calls is defined and message.tool_calls is not none %}
|
||||
{{- "[TOOL_CALLS] [" }}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- set out = tool_call.function|tojson %}
|
||||
{{- out[:-1] }}
|
||||
{%- if not tool_call.id is defined or tool_call.id|length != 9 %}
|
||||
{{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
|
||||
{%- endif %}
|
||||
{{- ', "id": "' + tool_call.id + '"}' }}
|
||||
{%- if not loop.last %}
|
||||
{{- ", " }}
|
||||
{%- else %}
|
||||
{{- "]" + eos_token }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- elif message["role"] == "assistant" %}
|
||||
{{- " " + message["content"]|trim + eos_token}}
|
||||
{%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
|
||||
{%- if message.content is defined and message.content.content is defined %}
|
||||
{%- set content = message.content.content %}
|
||||
{%- else %}
|
||||
{%- set content = message.content %}
|
||||
{%- endif %}
|
||||
{{- '[TOOL_RESULTS] {"content": ' + content|string + ", " }}
|
||||
{%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}
|
||||
{{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
|
||||
{%- endif %}
|
||||
{{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
|
||||
{%- else %}
|
||||
{{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"architectures": [
|
||||
"MistralForCausalLM"
|
||||
],
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 1,
|
||||
"dtype": "float16",
|
||||
"eos_token_id": 2,
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 4096,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 14336,
|
||||
"max_position_embeddings": 32768,
|
||||
"model_type": "mistral",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 32,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": null,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_parameters": {
|
||||
"rope_theta": 1000000.0,
|
||||
"rope_type": "default"
|
||||
},
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": false,
|
||||
"transformers_version": "5.13.0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 32768
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"transformers_version": "5.13.0"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:812688ceb15d9e337928861aa5b4a783375289ce849aeb19465a4cddd028f91c
|
||||
size 14496080848
|
||||
+275733
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"add_prefix_space": true,
|
||||
"backend": "tokenizers",
|
||||
"bos_token": "<s>",
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "</s>",
|
||||
"is_local": true,
|
||||
"legacy": false,
|
||||
"local_files_only": false,
|
||||
"model_max_length": 1000000000000000019884624838656,
|
||||
"pad_token": null,
|
||||
"sp_model_kwargs": {},
|
||||
"spaces_between_special_tokens": false,
|
||||
"tokenizer_class": "TokenizersBackend",
|
||||
"unk_token": "<unk>",
|
||||
"use_default_system_prompt": false
|
||||
}
|
||||
Reference in new issue
Block a user