初始化项目,由ModelHub XC社区提供模型
Model: wimpSquad/Llama-3.2-1B-glyph-translator-v8 Source: Original Platform
This commit is contained in:
37
.gitattributes
vendored
Normal file
37
.gitattributes
vendored
Normal file
@@ -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
|
||||
104
README.md
Normal file
104
README.md
Normal file
@@ -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.
|
||||
11
chat_template.jinja
Normal file
11
chat_template.jinja
Normal file
@@ -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 %}
|
||||
40
config.json
Normal file
40
config.json
Normal file
@@ -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
|
||||
}
|
||||
12
generation_config.json
Normal file
12
generation_config.json
Normal file
@@ -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"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:58703cc67129da51f2747c493c3b674c2335ce5316a01a4cfe8ae3ace9db269a
|
||||
size 2471645608
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:52716f60c3ad328509fa37cdded9a2f1196ecae463f5480f5d38c66a25e7a7dc
|
||||
size 17210019
|
||||
14
tokenizer_config.json
Normal file
14
tokenizer_config.json
Normal file
@@ -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"
|
||||
}
|
||||
3
v8-translator-best-f16.gguf
Normal file
3
v8-translator-best-f16.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f6c1d1d2c8a775af2f6f67fea85fd08f6d3d66aadf2b7f65034b855080a37274
|
||||
size 2479591840
|
||||
Reference in New Issue
Block a user