ArchiveStudio Ill-Ness commited on
Commit
b03b54e
·
0 Parent(s):

Duplicate from Muse-research/Muse2-230M

Browse files

Co-authored-by: Ill Ness <Ill-Ness@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ library_name: pytorch
6
+ pipeline_tag: text-generation
7
+ pretty_name: Muse2-230M
8
+ tags:
9
+ - text-generation
10
+ - conversational
11
+ - hybrid-attention
12
+ - convolution
13
+ - grouped-query-attention
14
+ - edge
15
+ - on-device
16
+ - structured-output
17
+ - json
18
+ - muse2
19
+ task_categories:
20
+ - text-generation
21
+ - conversational
22
+ size_categories:
23
+ - 100M<n<1B
24
+ base_model:
25
+ - Muse-research/Muse2-230M-Base
26
+ ---
27
+
28
+ # Muse2-230M
29
+
30
+ ## Model Information
31
+
32
+ The Muse2 collection is a family of compact language models built **entirely from scratch** — architecture, tokenizer, and inference stack — for edge and on-device use. Muse2 pairs an LFM2-style hybrid layout (short causal convolutions + grouped-query attention) with a parallel merged SwiGLU MLP per block, chosen for inference efficiency on constrained hardware. The instruction-tuned version is optimized for assistant-like chat, formatting, and structured extraction from developer logs.
33
+
34
+ **Model Developer:** Muse Research
35
+
36
+ **Model Architecture:** Muse2 is an auto-regressive language model that uses a hybrid convolution/attention architecture implemented from scratch in PyTorch (`Muse2ForCausalLM`, no `transformers` code). The tuned version is aligned with supervised fine-tuning (SFT) with completion-only loss masking. No RLHF or DPO has been applied.
37
+
38
+ | | Params | Input modalities | Output modalities | Context Length | GQA | Shared Embeddings | Knowledge cutoff |
39
+ | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- |
40
+ | Muse2-230M (Base) | 230M (196.1M) | English Text | English Text and code | 8k (128k max) | Yes | Yes | Early 2024 |
41
+ | Muse2-230M (Instruct) | 230M (196.1M) | English Text | English Text and code | 8k (128k max) | Yes | Yes | Early 2024 |
42
+
43
+ **Supported Languages:** English. The model also handles source code and mathematical text.
44
+
45
+ **Muse2 Model Family:** All model versions use Grouped-Query Attention (GQA, 16 query / 8 key-value heads) and tied input/output embeddings. The 14-block layout interleaves 8 causal depthwise short-convolution blocks (kernel size 3) with 6 full-attention blocks; RoPE with theta 1e6; RMSNorm; parallel merged SwiGLU MLPs (hidden 1024, ff 2560); vocabulary of 65,536 byte-level BPE tokens trained from scratch (pad=0, bos=1, eos=7, ChatML-style control tokens).
46
+
47
+ **Model Release Date:** Aug 23, 2026
48
+
49
+ **Status:** This is a static model. Later versions may be released that improve model capabilities.
50
+
51
+ **License:** Model weights are released under Apache-2.0.
52
+
53
+ ## Intended Use
54
+
55
+ **Intended Use Cases:** Muse2 is intended for research and education: studying compact hybrid architectures, edge/on-device inference, structured log-to-JSON extraction, formatting-disciplined output, and as a base for further fine-tuning. The Instruct version is intended for assistant-like chat in resource-constrained environments where a small footprint matters more than factual reliability.
56
+
57
+ **Out of Scope:** Production deployment without developer-side evaluation and guardrails. Any safety-critical, medical, legal, or factual-reliance use. Use in any manner that violates applicable laws or the upstream dataset licenses. The model has had **no safety alignment, red-teaming, or content filtering** applied.
58
+
59
+ ## How to use
60
+
61
+ This repository uses the from-scratch `muse` package (PyTorch + safetensors only). The config schema follows the LFM2-family layout for edge-tooling compatibility, but the architecture is not a transformers-native class.
62
+
63
+ ```python
64
+ import torch
65
+ from tokenizers import Tokenizer
66
+ from muse import Muse2ForCausalLM
67
+ from muse.sft_data import apply_chat_template
68
+
69
+ model = Muse2ForCausalLM.from_pretrained(".", dtype=torch.float32).eval()
70
+ tk = Tokenizer.from_file("tokenizer.json")
71
+
72
+ messages = [
73
+ {"role": "system", "content": "You are an automated, silent compiler API."},
74
+ {"role": "user", "content": "<raw log> + <required schema>"},
75
+ ]
76
+ ids = apply_chat_template(tk, messages) # ends at the assistant header
77
+ out = model.generate(torch.tensor([ids]), max_new_tokens=256,
78
+ temperature=0.2, top_k=50, eos_token_id=4) # <|im_end|>
79
+ print(tk.decode(out[0][len(ids):].tolist(), skip_special_tokens=True))
80
+ ```
81
+
82
+ Interactive chat on a single cloud T4:
83
+
84
+ ```bash
85
+ modal run modal_app.py::chat
86
+ ```
87
+
88
+ Local CPU chat: `python scripts/chat.py --model . --interactive`
89
+
90
+ ## Responsibility & Safety
91
+
92
+ Muse2 is a research artifact released without safety fine-tuning, red-teaming, or content classification. It can produce inaccurate, biased, repetitive, or otherwise objectionable output, and it **hallucinates facts readily at this model scale**. Developers are solely responsible for deployment decisions and should add appropriate input/output safeguards for any application, and should not rely on the model for correctness.
93
+
94
+ ## Ethical Considerations and Limitations
95
+
96
+ **Values:** Muse2 is intended to make small-scale, from-scratch language-model development accessible — every component (tokenizer, architecture, inference stack) is open and reproducible.
97
+
98
+ **Testing:** Safety and capability testing to date is limited to qualitative inspection. It does not cover, nor could it cover, all scenarios. Before any deployment, developers should perform testing appropriate to their use case. Upstream dataset licenses and attribution requirements continue to apply to derivative uses.
config.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Muse2ForCausalLM"
4
+ ],
5
+ "block__name_mlp": "parallel_mlp_merged",
6
+ "block_auto_adjust_ff_dim": false,
7
+ "block_dim": 1024,
8
+ "block_ff_dim": 2560,
9
+ "block_ffn_dim_multiplier": 1.0,
10
+ "block_ffn_te_autocast": false,
11
+ "block_ffn_use_quantized_params": false,
12
+ "block_mlp_init_scale": 1.0,
13
+ "block_multiple_of": 256,
14
+ "block_norm_eps": 1e-05,
15
+ "block_out_init_scale": 1.0,
16
+ "block_sequence_parallel_norm_across_tp": false,
17
+ "block_use_swiglu": true,
18
+ "block_use_xavier_init": true,
19
+ "bos_token_id": 1,
20
+ "conv_L_cache": 3,
21
+ "conv_bias": false,
22
+ "conv_dim": 1024,
23
+ "conv_use_xavier_init": true,
24
+ "dtype": "bfloat16",
25
+ "eos_token_id": 7,
26
+ "ffn_te_autocast": false,
27
+ "ffn_use_quantized_params": false,
28
+ "hidden_size": 1024,
29
+ "initializer_range": 0.02,
30
+ "intermediate_size": 2560,
31
+ "layer_types": [
32
+ "conv",
33
+ "conv",
34
+ "full_attention",
35
+ "conv",
36
+ "full_attention",
37
+ "conv",
38
+ "full_attention",
39
+ "conv",
40
+ "full_attention",
41
+ "conv",
42
+ "full_attention",
43
+ "conv",
44
+ "full_attention",
45
+ "conv"
46
+ ],
47
+ "max_position_embeddings": 128000,
48
+ "model_type": "muse2",
49
+ "norm_eps": 1e-05,
50
+ "num_attention_heads": 16,
51
+ "num_heads": 16,
52
+ "num_hidden_layers": 14,
53
+ "num_key_value_heads": 8,
54
+ "pad_token_id": 0,
55
+ "rope_parameters": {
56
+ "rope_theta": 1000000.0,
57
+ "rope_type": "default"
58
+ },
59
+ "sequence_parallel_norm_across_tp": false,
60
+ "tie_embedding": true,
61
+ "tie_word_embeddings": true,
62
+ "transformers_version": "5.2.0",
63
+ "use_cache": true,
64
+ "use_pos_enc": true,
65
+ "vocab_size": 65536
66
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 1,
3
+ "do_sample": true,
4
+ "eos_token_id": 4,
5
+ "pad_token_id": 0,
6
+ "temperature": 0.8,
7
+ "top_k": 50,
8
+ "top_p": 0.95,
9
+ "transformers_version": "5.2.0"
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce42e95258378b63959d4664552df969353b44779114eb77ad7d04f036ecb62e
3
+ size 392287592
special_tokens_map.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "<|bos|>": "<|bos|>",
3
+ "<|eos|>": "<|eos|>",
4
+ "<|im_end|>": "<|im_end|>",
5
+ "<|im_start|>": "<|im_start|>",
6
+ "<|pad|>": "<|pad|>",
7
+ "<|system|>": "<|system|>",
8
+ "<|unk|>": "<|unk|>",
9
+ "<|user|>": "<|user|>"
10
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "bos_token": "<|bos|>",
5
+ "bos_token_id": 1,
6
+ "chat_template": "{% for message in messages %}{{ '<|im_start|>' + message['role'] + '\\n' + message['content'] + '<|im_end|>' + '\\n' }}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\\n' }}{% endif %}",
7
+ "eos_token": "<|eos|>",
8
+ "eos_token_id": 7,
9
+ "model_max_length": 128000,
10
+ "pad_token": "<|pad|>",
11
+ "pad_token_id": 0,
12
+ "unk_token": "<|unk|>",
13
+ "vocab_size": 65536
14
+ }