初始化项目,由ModelHub XC社区提供模型
Model: h4bbo/FuseLLM-112M 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
|
||||||
|
FuseLLM-112M.bf16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
3
FuseLLM-112M.bf16.gguf
Normal file
3
FuseLLM-112M.bf16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:4e7210a19f6f88e1cc5a0c93b49f7fd907bbb8e623e4c66b07335133b7899d4c
|
||||||
|
size 229719904
|
||||||
135
README.md
Normal file
135
README.md
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
---
|
||||||
|
library_name: transformers
|
||||||
|
license: apache-2.0
|
||||||
|
base_model: h4bbo/FuseLLM-112M-Completion
|
||||||
|
tags:
|
||||||
|
- habbo
|
||||||
|
- code
|
||||||
|
- chatml
|
||||||
|
- sft
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
---
|
||||||
|
|
||||||
|
# FuseLLM-112M (Chat)
|
||||||
|
|
||||||
|
This is the **ChatML chat** variant of FuseLLM-112M — a 112M-parameter, from-scratch
|
||||||
|
Qwen3-architecture decoder-only model supervised-fine-tuned (SFT) on on-domain Habbo instruction
|
||||||
|
pairs derived **from the Habbo source corpus itself** (no external/teacher data).
|
||||||
|
|
||||||
|
The base model, [h4bbo/FuseLLM-112M-Completion](https://huggingface.co/h4bbo/FuseLLM-112M-Completion),
|
||||||
|
was trained only on raw Habbo code in completion mode. Its tokenizer already shipped a Qwen3
|
||||||
|
ChatML template, but the weights had never seen a chat turn, so chat-formatted prompts produced
|
||||||
|
poor, repetitive output. This checkpoint teaches the weights to follow ChatML turns and to **emit
|
||||||
|
`<|im_end|>`** at the end of an assistant answer (the turn terminator — conveniently the same token,
|
||||||
|
151645, the base model was trained to use as a document boundary), which is what stops the runaway
|
||||||
|
repetition.
|
||||||
|
|
||||||
|
## Use
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
import torch
|
||||||
|
|
||||||
|
model_id = "h4bbo/FuseLLM-112M"
|
||||||
|
tok = AutoTokenizer.from_pretrained(model_id)
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
model_id, torch_dtype=torch.bfloat16, device_map="auto", attn_implementation="sdpa")
|
||||||
|
|
||||||
|
messages = [
|
||||||
|
{"role": "system", "content": "You are a Habbo Hotel emulator code assistant. Reply with concise, correct code or a brief explanation."},
|
||||||
|
{"role": "user", "content": "Implement this Java method:\n```java\npublic static void sendRoomPacket(Session s, int header) { }\n```"},
|
||||||
|
]
|
||||||
|
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||||||
|
ids = tok(text, return_tensors="pt").to(model.device)
|
||||||
|
out = model.generate(**ids, max_new_tokens=256, eos_token_id=151645, pad_token_id=151643,
|
||||||
|
do_sample=True, temperature=0.7, top_p=0.9, repetition_penalty=1.05)
|
||||||
|
print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
|
||||||
|
```
|
||||||
|
|
||||||
|
It is designed for Habbo-coding instructions (method/class completion, code continuation,
|
||||||
|
doc→code). It is **not** a general assistant — outside its narrow domain it will produce poor or
|
||||||
|
repetitive output.
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
`Qwen3ForCausalLM`, hidden 512, 8 layers (full attention), 8 heads / 8 KV heads, intermediate
|
||||||
|
1408, vocab 151,936, max context 2048, `tie_word_embeddings=true`. Trained in bf16.
|
||||||
|
|
||||||
|
## Training data
|
||||||
|
|
||||||
|
10,000 ChatML conversations derived deterministically from the Habbo corpus (the same corpus the
|
||||||
|
base was trained on — 84,925 unique files, ~210M est. tokens; top languages Java 26,335 /
|
||||||
|
C# 19,048 / PHP 10,969 / ActionScript 3,801). No external data, no teacher model. Templates:
|
||||||
|
|
||||||
|
- **Method completion** — given a method signature with empty body, return the real body.
|
||||||
|
- **Code continuation** — given a file prefix, return the real suffix.
|
||||||
|
- **Doc → method** — given a Javadoc/PHPDoc/`///` summary, return the real method.
|
||||||
|
|
||||||
|
Distribution in this build: Java ~4,936 · C# ~3,752 · PHP ~989 · ActionScript ~323. Decompiler
|
||||||
|
noise (JD-Core `/* N:M */` line markers and `/* Location: … */` footers) is stripped. Secrets are
|
||||||
|
scrubbed to `[REDACTED]` (currently `xX!elgps`) before extraction; the training file is verified to
|
||||||
|
contain 0 secret occurrences.
|
||||||
|
|
||||||
|
## Training config
|
||||||
|
|
||||||
|
- Full fine-tune (no LoRA — 112M is small enough to train every weight on 24 GB).
|
||||||
|
- TRL `SFTTrainer` + `SFTConfig`, `messages` format auto-detected, ChatML applied by the base
|
||||||
|
tokenizer's chat template. `packing=False`, `max_length=2048` (model's native max position; only
|
||||||
|
11/10,000 conversations exceed it). Full-sequence causal-LM loss (the Qwen3 chat template has no
|
||||||
|
`{% generation %}` markers, so `assistant_only_loss` is unset — at inference we prompt through
|
||||||
|
`<|im_start|>assistant\n` and stop at `<|im_end|>`).
|
||||||
|
- bf16, sdpa attention, `adamw_torch`, cosine schedule, 3 epochs, LR 2e-5, warmup 0.03,
|
||||||
|
effective batch 16 (BS 4 × GA 4), `max_grad_norm=1.0`, seed 42. 1,875 steps.
|
||||||
|
- `generation_config.json` is written with `eos_token_id=151645` (`<|im_end|>`),
|
||||||
|
`pad_token_id=151643`, `temperature=0.7`, `top_p=0.9`, `repetition_penalty=1.05`.
|
||||||
|
|
||||||
|
## Training result
|
||||||
|
|
||||||
|
Loss dropped from ~1.83 (step 10) to ~0.45 by the end of epoch 1 and held in the ~0.4–0.5 range
|
||||||
|
through epochs 2–3. Final: `train_loss 0.521`, `mean_token_accuracy 0.9144`, 1,875 steps, ~16.5 min
|
||||||
|
on a single RX 7900 XTX (ROCm). Verified behavior: method-completion and code-continuation prompts
|
||||||
|
produce coherent on-domain Habbo code, close the fenced block, and **stop at `<|im_end|>`**;
|
||||||
|
doc→method and free-form explanation prompts tend to ramble (see Limitations).
|
||||||
|
|
||||||
|
## Redaction
|
||||||
|
|
||||||
|
Secrets (currently `xX!elgps`) are scrubbed to `[REDACTED]` in all training content before
|
||||||
|
tokenisation. The output training file is checked to contain 0 occurrences. No known credentials
|
||||||
|
enter the weights.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Released under **Apache-2.0**. See the base model
|
||||||
|
[h4bbo/FuseLLM-112M-Completion](https://huggingface.co/h4bbo/FuseLLM-112M-Completion) for its
|
||||||
|
license terms.
|
||||||
|
|
||||||
|
## GGUF
|
||||||
|
|
||||||
|
A non-quantized **bf16** GGUF — `FuseLLM-112M.bf16.gguf` (~220 MB, a bit-exact copy of the bf16
|
||||||
|
safetensors weights, so truly lossless) — is included in this repo for use with
|
||||||
|
[llama.cpp](https://github.com/ggml-org/llama.cpp) / [Ollama](https://ollama.com). The ChatML chat
|
||||||
|
template and the EOS token (`<|im_end|>`, 151645) are embedded as GGUF metadata, so the model loads
|
||||||
|
in chat mode automatically. No quantized (Q4/Q5/Q8) variant is shipped here.
|
||||||
|
|
||||||
|
Example with llama.cpp:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
llama-cli -m FuseLLM-112M.bf16.gguf -cnv \
|
||||||
|
--temp 0.7 --top-p 0.9 --repeat-penalty 1.05 -n 256 \
|
||||||
|
-p "Implement this Java method:\n```java\npublic static void sendRoomPacket(Session s, int h) { }\n```"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Intended use
|
||||||
|
|
||||||
|
Domain-specialist code assistant for the Habbo Hotel emulator ecosystem (server/client tooling).
|
||||||
|
Not affiliated with or endorsed by Sulake/Habbo.
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
- 112M parameters — narrow capacity; expect errors and repetition on long or off-domain prompts.
|
||||||
|
- Trained only on on-domain code-instruction pairs; not a general chat / instruction model.
|
||||||
|
- Doc→method and free-form explanation prompts often ramble past `<|im_end|>` despite
|
||||||
|
`repetition_penalty`; keep `max_new_tokens` modest and prefer the SFT templates
|
||||||
|
(method completion / code continuation).
|
||||||
61
chat_template.jinja
Normal file
61
chat_template.jinja
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{%- if tools %}
|
||||||
|
{{- '<|im_start|>system\n' }}
|
||||||
|
{%- if messages[0].role == 'system' %}
|
||||||
|
{{- messages[0].content + '\n\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||||
|
{%- for tool in tools %}
|
||||||
|
{{- "\n" }}
|
||||||
|
{{- tool | tojson }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||||
|
{%- else %}
|
||||||
|
{%- if messages[0].role == 'system' %}
|
||||||
|
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- for message in messages %}
|
||||||
|
{%- if message.content is string %}
|
||||||
|
{%- set content = message.content %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set content = '' %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
||||||
|
{%- elif message.role == "assistant" %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||||
|
{%- if message.tool_calls %}
|
||||||
|
{%- for tool_call in message.tool_calls %}
|
||||||
|
{%- if (loop.first and content) or (not loop.first) %}
|
||||||
|
{{- '\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if tool_call.function %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<tool_call>\n{"name": "' }}
|
||||||
|
{{- tool_call.name }}
|
||||||
|
{{- '", "arguments": ' }}
|
||||||
|
{%- if tool_call.arguments is string %}
|
||||||
|
{{- tool_call.arguments }}
|
||||||
|
{%- else %}
|
||||||
|
{{- tool_call.arguments | tojson }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '}\n</tool_call>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- elif message.role == "tool" %}
|
||||||
|
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||||
|
{{- '<|im_start|>user' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n<tool_response>\n' }}
|
||||||
|
{{- content }}
|
||||||
|
{{- '\n</tool_response>' }}
|
||||||
|
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- if add_generation_prompt %}
|
||||||
|
{{- '<|im_start|>assistant\n' }}
|
||||||
|
{%- endif %}
|
||||||
43
config.json
Normal file
43
config.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"Qwen3ForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": null,
|
||||||
|
"dtype": "float32",
|
||||||
|
"eos_token_id": 151645,
|
||||||
|
"head_dim": 128,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 512,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 1408,
|
||||||
|
"layer_types": [
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention"
|
||||||
|
],
|
||||||
|
"max_position_embeddings": 2048,
|
||||||
|
"max_window_layers": 28,
|
||||||
|
"model_type": "qwen3",
|
||||||
|
"num_attention_heads": 8,
|
||||||
|
"num_hidden_layers": 8,
|
||||||
|
"num_key_value_heads": 8,
|
||||||
|
"pad_token_id": 151643,
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_parameters": {
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"rope_type": "default"
|
||||||
|
},
|
||||||
|
"sliding_window": null,
|
||||||
|
"tie_word_embeddings": true,
|
||||||
|
"transformers_version": "5.13.0",
|
||||||
|
"use_cache": false,
|
||||||
|
"use_sliding_window": false,
|
||||||
|
"vocab_size": 151936
|
||||||
|
}
|
||||||
9
generation_config.json
Normal file
9
generation_config.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"do_sample": true,
|
||||||
|
"eos_token_id": 151645,
|
||||||
|
"pad_token_id": 151643,
|
||||||
|
"repetition_penalty": 1.05,
|
||||||
|
"temperature": 0.7,
|
||||||
|
"top_p": 0.9,
|
||||||
|
"transformers_version": "5.13.0"
|
||||||
|
}
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c43a20ce7f6a60ad0f73c159c9f50f3e1d43758c7ca91d3c4ee3d9f36e68e07a
|
||||||
|
size 447532792
|
||||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
|
||||||
|
size 11422650
|
||||||
30
tokenizer_config.json
Normal file
30
tokenizer_config.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"backend": "tokenizers",
|
||||||
|
"bos_token": null,
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"errors": "replace",
|
||||||
|
"extra_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>",
|
||||||
|
"<|object_ref_start|>",
|
||||||
|
"<|object_ref_end|>",
|
||||||
|
"<|box_start|>",
|
||||||
|
"<|box_end|>",
|
||||||
|
"<|quad_start|>",
|
||||||
|
"<|quad_end|>",
|
||||||
|
"<|vision_start|>",
|
||||||
|
"<|vision_end|>",
|
||||||
|
"<|vision_pad|>",
|
||||||
|
"<|image_pad|>",
|
||||||
|
"<|video_pad|>"
|
||||||
|
],
|
||||||
|
"is_local": true,
|
||||||
|
"local_files_only": false,
|
||||||
|
"model_max_length": 1010000,
|
||||||
|
"pad_token": "<|endoftext|>",
|
||||||
|
"split_special_tokens": false,
|
||||||
|
"tokenizer_class": "Qwen2Tokenizer",
|
||||||
|
"unk_token": null
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user