初始化项目,由ModelHub XC社区提供模型

Model: chartreuse-verte/orb-human-typeahead-350m-v1
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-07-25 12:40:11 +08:00
commit 995f2ddf90
9 changed files with 502307 additions and 0 deletions

36
.gitattributes vendored Normal file
View File

@@ -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
GGUF/orb-human-typeahead-350m-v1-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:74f2b6a71ef9be9c9271d3378f2cc7415ef899b65bd852be8e0027ff0dc0be55
size 378130720

122
README.md Normal file
View File

@@ -0,0 +1,122 @@
---
license: apache-2.0
base_model: ibm-granite/granite-4.0-350m-base
pipeline_tag: text-generation
language:
- en
tags:
- typeahead
- autocomplete
- roleplay
- granite
- gguf
library_name: transformers
---
# orb-human-typeahead-350m-v1
A 350M typeahead model that predicts **the human's next few words** in a
roleplay chat — inline "ghost text" for the person typing, not a reply
generator for the character. Full fine-tune of
[ibm-granite/granite-4.0-350m-base](https://huggingface.co/ibm-granite/granite-4.0-350m-base).
Most small LMs asked to continue a user's half-typed roleplay message produce
fluent but irrelevant text. This model is trained specifically on
(conversation context + partial user message → the words the user actually
typed next), so its suggestions stay on-scene and in-voice.
## Variants
| Path | Format | Use with |
|---|---|---|
| `/` | safetensors bf16, plain `granite` arch | transformers |
| `GGUF/orb-human-typeahead-350m-v1-Q8_0.gguf` | GGUF Q8_0 | llama.cpp / llama-cpp-python |
This 350M variant is attention-only and dense, the weights are republished here as
the equivalent plain `granite` architecture (logit-identical, verified), which
loads everywhere without extras.
## Prompt format
Plain text, no chat template. Optional character summary, a marker line,
name-prefixed turns, and finally the user's draft — the model continues the
draft. Cut the suggestion at the first newline.
```
<character summary, optional>
***Roleplay chat below***
Sylvara: *She looks down from the watchtower and sees you.*
Traveler: *I approach the encampment.*
Sylvara: *She lowers her bow as you approach the gate.* "State your business, traveler."
Traveler: *I raise both hands slowly and
```
A completion looks like ` step into the torchlight, keeping my voice low.*`
Notes:
- Trained to trigger at **word boundaries** only (draft ends on a whole word,
or on a trailing space). Mid-word completion is out of scope.
- Trained context: up to ~4 recent turns, summaries ≤400 chars (prune tail), turns ≤500 chars (prune head).
## Serving recipe
Greedy, short budget, stop at newline — mirrors how it was trained and evaluated:
```python
from llama_cpp import Llama
llm = Llama("GGUF/orb-human-typeahead-350m-v1-Q8_0.gguf", n_ctx=1024)
out = llm.create_completion(prompt, max_tokens=12, stop=["\n"], temperature=0.0)
print(out["choices"][0]["text"])
```
Or with transformers:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("chartreuse-verte/orb-human-typeahead-350m-v1")
model = AutoModelForCausalLM.from_pretrained("chartreuse-verte/orb-human-typeahead-350m-v1")
ids = tok(prompt, return_tensors="pt").input_ids
out = model.generate(ids, max_new_tokens=12, do_sample=False)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True).split("\n")[0])
```
## Evaluation
Scored on a held-out validation set of real roleplay conversations (120
prompts, conversation-disjoint from training; greedy, 12-token budget,
suggestions cut at newline). word-EM@k = fraction of prompts where the first
k words of the suggestion exactly match what the user really typed next;
prefix-chars = mean length of the exactly-matching leading characters.
| Metric | granite-4.0-350m-base | this model |
|---|---|---|
| word-EM@1 | 0.158 | **0.300** |
| word-EM@2 | 0.017 | **0.083** |
| word-EM@3 | 0.000 | **0.033** |
| prefix-chars | 1.82 | **2.89** |
| completion perplexity | 29.56 | **12.97** |
| gen speed on DDR4 + Ryzen 5 (t/s) | 48.2 | 48.2 |
| prefill speed on DDR4 + Ryzen 5 (t/s) | 572.9 | 572.9 |
Absolute numbers are modest by design — creative roleplay is high-entropy, so
even a perfect suggester can't guess most continuations. The gap vs the base
model is the point: the base model's suggestions are fluent but off-scene.
## Training
Two-stage full fine-tune of granite-4.0-350m-base: first on synthetic multi-turn
RP data, but the adversarial model is instructed to give concise and low-entropy responses,
then on a smaller private in-domain set in the serve-time prompt
format (with stage-1 replay to limit forgetting). Examples are user turns
split at word boundaries; loss is on the continuation. Suggestions are
single-line by construction (completions end at newline).
## Limitations
- English-centric, roleplay register (asterisk actions, quoted dialogue).
Out of domain for assistant chat, code, or formal prose.
- Roleplay corpora include mature themes; suggestions can reflect that.
- Not an instruction follower — it only continues drafts in the format above.
- Suggests at word boundaries; won't complete a half-typed word.

32
config.json Normal file
View File

@@ -0,0 +1,32 @@
{
"architectures": [
"GraniteForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"attention_multiplier": 0.015625,
"bos_token_id": 100257,
"dtype": "bfloat16",
"embedding_multiplier": 12,
"eos_token_id": 100257,
"hidden_act": "silu",
"hidden_size": 1024,
"initializer_range": 0.02,
"intermediate_size": 2048,
"logits_scaling": 4,
"max_position_embeddings": 32768,
"mlp_bias": false,
"model_type": "granite",
"num_attention_heads": 16,
"num_hidden_layers": 28,
"num_key_value_heads": 4,
"pad_token_id": 100256,
"residual_multiplier": 0.263,
"rms_norm_eps": 1e-05,
"rope_scaling": null,
"rope_theta": 10000000,
"tie_word_embeddings": true,
"transformers_version": "4.57.6",
"use_cache": true,
"vocab_size": 100352
}

7
generation_config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"_from_model_config": true,
"bos_token_id": 100257,
"eos_token_id": 100257,
"pad_token_id": 100256,
"transformers_version": "4.57.6"
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:da5e67d33417ed1cd73207250b3f91baa1f7424c80a577f3a5486999f21ce7f2
size 704788728

30
special_tokens_map.json Normal file
View File

@@ -0,0 +1,30 @@
{
"bos_token": {
"content": "<|end_of_text|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"eos_token": {
"content": "<|end_of_text|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"pad_token": {
"content": "<|pad|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"unk_token": {
"content": "<|unk|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
}

501289
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

785
tokenizer_config.json Normal file
View File

@@ -0,0 +1,785 @@
{
"add_prefix_space": false,
"added_tokens_decoder": {
"100256": {
"content": "<|pad|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100257": {
"content": "<|end_of_text|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100258": {
"content": "<|fim_prefix|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100259": {
"content": "<|fim_middle|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100260": {
"content": "<|fim_suffix|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100261": {
"content": "<|fim_pad|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100262": {
"content": "<|filename|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100263": {
"content": "<|reponame|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100264": {
"content": "<|start_of_role|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100265": {
"content": "<|end_of_role|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100266": {
"content": "<|unused_1|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100267": {
"content": "<|start_of_plugin|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100268": {
"content": "<|end_of_plugin|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100269": {
"content": "<|unk|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100270": {
"content": "<tool_call>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100271": {
"content": "</tool_call>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100272": {
"content": "<tool_response>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100273": {
"content": "</tool_response>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100274": {
"content": "<think>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100275": {
"content": "</think>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": false
},
"100276": {
"content": "<think_on>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100277": {
"content": "<think_off>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100278": {
"content": "<schema>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100279": {
"content": "</schema>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100280": {
"content": "<tools>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100281": {
"content": "</tools>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100282": {
"content": "<documents>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100283": {
"content": "</documents>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100284": {
"content": "<|unused_15|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100285": {
"content": "<|unused_16|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100286": {
"content": "<|unused_17|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100287": {
"content": "<|unused_18|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100288": {
"content": "<|unused_19|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100289": {
"content": "<|unused_20|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100290": {
"content": "<|unused_21|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100291": {
"content": "<|unused_22|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100292": {
"content": "<|unused_23|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100293": {
"content": "<|unused_24|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100294": {
"content": "<|unused_25|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100295": {
"content": "<|unused_26|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100296": {
"content": "<|unused_27|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100297": {
"content": "<|unused_28|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100298": {
"content": "<|unused_29|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100299": {
"content": "<|unused_30|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100300": {
"content": "<|unused_31|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100301": {
"content": "<|unused_32|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100302": {
"content": "<|unused_33|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100303": {
"content": "<|unused_34|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100304": {
"content": "<|unused_35|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100305": {
"content": "<|unused_36|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100306": {
"content": "<|unused_37|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100307": {
"content": "<|unused_38|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100308": {
"content": "<|unused_39|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100309": {
"content": "<|unused_40|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100310": {
"content": "<|unused_41|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100311": {
"content": "<|unused_42|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100312": {
"content": "<|unused_43|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100313": {
"content": "<|unused_44|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100314": {
"content": "<|unused_45|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100315": {
"content": "<|unused_46|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100316": {
"content": "<|unused_47|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100317": {
"content": "<|unused_48|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100318": {
"content": "<|unused_49|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100319": {
"content": "<|unused_50|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100320": {
"content": "<|unused_51|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100321": {
"content": "<|unused_52|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100322": {
"content": "<|unused_53|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100323": {
"content": "<|unused_54|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100324": {
"content": "<|unused_55|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100325": {
"content": "<|unused_56|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100326": {
"content": "<|unused_57|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100327": {
"content": "<|unused_58|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100328": {
"content": "<|unused_59|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100329": {
"content": "<|unused_60|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100330": {
"content": "<|unused_61|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100331": {
"content": "<|unused_62|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100332": {
"content": "<|unused_63|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100333": {
"content": "<|unused_64|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100334": {
"content": "<|unused_65|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100335": {
"content": "<|unused_66|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100336": {
"content": "<|unused_67|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100337": {
"content": "<|unused_68|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100338": {
"content": "<|unused_69|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100339": {
"content": "<|unused_70|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100340": {
"content": "<|unused_71|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100341": {
"content": "<|unused_72|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100342": {
"content": "<|unused_73|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100343": {
"content": "<|unused_74|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100344": {
"content": "<|unused_75|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100345": {
"content": "<|unused_76|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100346": {
"content": "<|unused_77|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100347": {
"content": "<|unused_78|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100348": {
"content": "<|unused_79|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100349": {
"content": "<|unused_80|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100350": {
"content": "<|unused_81|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"100351": {
"content": "<|unused_82|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
}
},
"backend": "tokenizers",
"bos_token": "<|end_of_text|>",
"clean_up_tokenization_spaces": false,
"eos_token": "<|end_of_text|>",
"extra_special_tokens": {},
"is_local": true,
"local_files_only": false,
"model_max_length": 1000000000000000019884624838656,
"pad_token": "<|pad|>",
"padding_side": "left",
"tokenizer_class": "PreTrainedTokenizerFast",
"unk_token": "<|unk|>"
}