From 9c09db19c4ea95f676153a34b6dd9d19ef4ec3af Mon Sep 17 00:00:00 2001 From: ModelHub XC Date: Tue, 7 Jul 2026 20:31:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=8C=E7=94=B1ModelHub=20XC=E7=A4=BE=E5=8C=BA=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Model: wimpSquad/Llama-3.2-1B-glyph-translator-v8 Source: Original Platform --- .gitattributes | 37 +++++++++++++ README.md | 104 ++++++++++++++++++++++++++++++++++++ chat_template.jinja | 11 ++++ config.json | 40 ++++++++++++++ generation_config.json | 12 +++++ model.safetensors | 3 ++ tokenizer.json | 3 ++ tokenizer_config.json | 14 +++++ v8-translator-best-f16.gguf | 3 ++ 9 files changed, 227 insertions(+) create mode 100644 .gitattributes create mode 100644 README.md create mode 100644 chat_template.jinja create mode 100644 config.json create mode 100644 generation_config.json create mode 100644 model.safetensors create mode 100644 tokenizer.json create mode 100644 tokenizer_config.json create mode 100644 v8-translator-best-f16.gguf diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..19d4f34 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,37 @@ +*.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 +tokenizer.json filter=lfs diff=lfs merge=lfs -text +v8-translator-best-f16.gguf filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..7395094 --- /dev/null +++ b/README.md @@ -0,0 +1,104 @@ +--- +license: llama3.2 +base_model: meta-llama/Llama-3.2-1B-Instruct +library_name: transformers +pipeline_tag: text-generation +tags: +- glyph +- translator +- ape +- full-finetune +--- + +# Llama-3.2-1B-glyph-translator-v8 + +**Built with Llama.** + +`glyph-translator-v8` is a full fine-tune of **Llama-3.2-1B-Instruct** that acts +as the **translator** stage of the [APE](https://github.com/real-wimpSquad) +(Agent Persistence Exocortex) pipeline. It rewrites a curator-style claim +decomposition into **Glyph** — a compact, operator-based notation (`→`, `↑`/`↓`, +`:`, `↔`, `|`, `[...]` packs) that the downstream graph layer stores and relates. +Its operating principle is *preserve, don't compress*: every claim survives, and +hedge/scope/direction are kept rather than flattened. + +## What it does + +Input: a single-claim `(S:, C:)` document — one subject, one claim. +Output: the Glyph rendition of that claim. + +``` +# input +S: hyperventilation +C: causes too little CO2 in the blood because CO2 is breathed out too quickly + +# output +hyperventilation→↓CO2:in_blood +``` + +The model is deployed **promptless** — no system prompt at serve time. It emits +the rendition directly. + +## Training + +- **Base:** `meta-llama/Llama-3.2-1B-Instruct` +- **Method:** full fine-tune (bf16, no LoRA) +- **Unit — per-S:C single-claim:** the training document is one `(subject, + single-claim)` pair, not a multi-subject chunk. This matches APE's truth-doc + granularity (one claim in, one Glyph edge out) and structurally removes the + dominant distillation failure — teachers *dropping claims* when summarizing + dense multi-claim inputs. Curator chunks are exploded to single-claim units + before translation and recombined afterward (handled by the APE pipeline). +- **Teacher / prompt:** distilled at single-claim granularity under the + **`v8_per_sc.md`** prompt; ~95% reader-decode faithfulness at smoke scale. +- **Corpus:** `v8-persc-distill-20260601` (78,932 single-claim pairs), + chunk-keyed 80/10/10 split (train 63,155 / val 7,904 / heldout 7,873). Train + is 85% bare / 15% adversarial system prompts; val + heldout are 100% bare (the + deployment condition). Best validation loss **0.2554** at epoch 2. + +### Chat template + +This model ships a **bare** chat template (`llama3-bare-v8`): no `Today Date` +system block, system turn emitted only when a real system message is present. +This keeps train == serve for a promptless translator. Load the tokenizer from +**this repo** (not the stock base) so the bare template is applied. In +validation it ignored an injected jailbreak system prompt and rendered +faithfully. + +## Usage + +### transformers +```python +from transformers import AutoModelForCausalLM, AutoTokenizer + +repo = "wimpSquad/Llama-3.2-1B-glyph-translator-v8" +tok = AutoTokenizer.from_pretrained(repo) +model = AutoModelForCausalLM.from_pretrained(repo) + +msgs = [{"role": "user", "content": "S: hyperventilation\nC: causes too little CO2 in the blood because CO2 is breathed out too quickly"}] +ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt") +out = model.generate(ids, max_new_tokens=256, do_sample=False) # greedy +print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True)) +``` + +Feed one `(S:, C:)` claim at a time, greedy decoding. The bare template carries +in the tokenizer, so no system prompt is needed. + +### llama.cpp (GGUF) +An f16 GGUF of the `best` checkpoint is included for llama.cpp serving: +- `v8-translator-best-f16.gguf` (f16, full precision) + +```bash +hf download wimpSquad/Llama-3.2-1B-glyph-translator-v8 v8-translator-best-f16.gguf --local-dir . +llama-cli -m v8-translator-best-f16.gguf -p "S: hyperventilation +C: causes too little CO2 in the blood because CO2 is breathed out too quickly" +``` + +Serve promptless (no system prompt); the GGUF was converted from `best/` with +the bare `llama3-bare-v8` template baked in. + +## License + +Derived from Llama-3.2-1B-Instruct and distributed under the +[Llama 3.2 Community License](https://github.com/meta-llama/llama-models/blob/main/models/llama3_2/LICENSE). +Your use is also subject to Meta's Acceptable Use Policy. diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..4c05b47 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,11 @@ +{{- bos_token }} +{%- if messages[0]['role'] == 'system' %} + {{- '<|start_header_id|>system<|end_header_id|>\n\n' + messages[0]['content'] | trim + '<|eot_id|>' }} + {%- set messages = messages[1:] %} +{%- endif %} +{%- for message in messages %} + {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'] | trim + '<|eot_id|>' }} +{%- endfor %} +{%- if add_generation_prompt %} + {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }} +{%- endif %} diff --git a/config.json b/config.json new file mode 100644 index 0000000..fc33f79 --- /dev/null +++ b/config.json @@ -0,0 +1,40 @@ +{ + "architectures": [ + "LlamaForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": 128000, + "dtype": "bfloat16", + "eos_token_id": [ + 128001, + 128008, + 128009 + ], + "head_dim": 64, + "hidden_act": "silu", + "hidden_size": 2048, + "initializer_range": 0.02, + "intermediate_size": 8192, + "max_position_embeddings": 131072, + "mlp_bias": false, + "model_type": "llama", + "num_attention_heads": 32, + "num_hidden_layers": 16, + "num_key_value_heads": 8, + "pad_token_id": null, + "pretraining_tp": 1, + "rms_norm_eps": 1e-05, + "rope_parameters": { + "factor": 32.0, + "high_freq_factor": 4.0, + "low_freq_factor": 1.0, + "original_max_position_embeddings": 8192, + "rope_theta": 500000.0, + "rope_type": "llama3" + }, + "tie_word_embeddings": true, + "transformers_version": "5.5.3", + "use_cache": true, + "vocab_size": 128256 +} diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..3a2d4cd --- /dev/null +++ b/generation_config.json @@ -0,0 +1,12 @@ +{ + "bos_token_id": 128000, + "do_sample": true, + "eos_token_id": [ + 128001, + 128008, + 128009 + ], + "temperature": 0.6, + "top_p": 0.9, + "transformers_version": "5.5.3" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..31d7fe9 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58703cc67129da51f2747c493c3b674c2335ce5316a01a4cfe8ae3ace9db269a +size 2471645608 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..bf19ce7 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52716f60c3ad328509fa37cdded9a2f1196ecae463f5480f5d38c66a25e7a7dc +size 17210019 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..95a7a46 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,14 @@ +{ + "backend": "tokenizers", + "bos_token": "<|begin_of_text|>", + "clean_up_tokenization_spaces": true, + "eos_token": "<|eot_id|>", + "is_local": true, + "model_input_names": [ + "input_ids", + "attention_mask" + ], + "model_max_length": 131072, + "pad_token": "<|eot_id|>", + "tokenizer_class": "TokenizersBackend" +} diff --git a/v8-translator-best-f16.gguf b/v8-translator-best-f16.gguf new file mode 100644 index 0000000..20a19b2 --- /dev/null +++ b/v8-translator-best-f16.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6c1d1d2c8a775af2f6f67fea85fd08f6d3d66aadf2b7f65034b855080a37274 +size 2479591840