Hoglet-33 commited on
Commit
3c5b617
·
verified ·
1 Parent(s): cf79d1c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +152 -0
README.md CHANGED
@@ -1,3 +1,155 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - pebble
8
+ - language-model
9
+ - base-model
10
+ - small-language-model
11
+ - pytorch
12
+ - safetensors
13
+ - custom-code
14
+ - mamba2
15
+ - hybrid
16
+ library_name: transformers
17
  ---
18
+
19
+ # Pebble-25M
20
+
21
+ ![Banner](banner.png)
22
+
23
+ Pebble-25M is a compact, hybrid autoregressive language model. It combines the efficiency of state-space models with the proven performance of attention layers, optimized using a custom Muon + AdamW optimizer split.
24
+
25
+ ## Model Details
26
+
27
+ - **Architecture:** Hybrid Mamba2 / Transformer
28
+ - **Block Pattern:** 3 Mamba2 blocks : 1 Attention block (repeating)
29
+ - **Parameters:** ~24,500,000 (25M)
30
+ - **Hidden Dimension:** 608
31
+ - **Layers:** 8 (6 Mamba2, 2 Attention)
32
+ - **Vocab Size:** 2,048 (Custom Byte-Level BPE)
33
+ - **Context Length:** 2048
34
+ - **Training Tokens:** ~25,000,000,000 (~25 Billion)
35
+ - **Optimizer:** Muon (for 2D hidden weights) + AdamW (for embeddings, norms, and scalars)
36
+ - **Precision:** fp32 master weights with bf16 autocast
37
+
38
+ ## Dataset Sources
39
+
40
+ The model was trained on a 25B token subset of the following datasets (packaged as `Hoglet-33/25BT-PreTrain-v2`):
41
+
42
+ | Dataset | Token Allocation | Share |
43
+ |---|---:|---:|
44
+ | FineWeb-Edu | 7.50 billion | 30% |
45
+ | DCLM | 5.00 billion | 20% |
46
+ | Cosmopedia-v2 | 3.75 billion | 15% |
47
+ | FineMath-4+ | 3.75 billion | 15% |
48
+ | FinePhrase | 3.00 billion | 12% |
49
+ | NPset | 2.00 billion | 8% |
50
+
51
+ ## Benchmarks
52
+
53
+ | Benchmark | **Pebble-25M** | Pebble-25M Chat | Pebble-10M | BananaMind-2-Mini | Random |
54
+ |---|---:|---:|---:|---:|---:|
55
+ | PIQA | 59.25% | 53.37% | 58.43% | **59.63%** | 50.00% |
56
+ | ARC-Easy | 38.17% | 26.68% | 37.29% | **39.86%** | 25.00% |
57
+ | ARC-Challenge | 18.60% | 19.62% | 18.60% | **25.68%** | 25.00% |
58
+ | HellaSwag | 27.62% | 25.63% | 26.81% | **29.72%** | 25.00% |
59
+ | ArithMark-2.0 | 27.60% | 26.20% | **27.64%** | 27.52% | 25.00% |
60
+ | ArithMark-3.0 | 33.80% | 28.80% | 32.80% | **34.90%** | 25.00% |
61
+
62
+ ### Evaluation Notes
63
+
64
+ - PIQA, ARC-Easy, ARC-Challenge, and HellaSwag were evaluated on their respective test splits.
65
+ - ArithMark-2.0 was evaluated on its train split due to the lack of a suitable test split.
66
+ - ArithMark-3.0 was evaluated on its train split due to the lack of a suitable test split.
67
+ - Results were obtained using zero-shot multiple-choice evaluation.
68
+ - No task-specific fine-tuning was performed.
69
+
70
+ ## Usage
71
+
72
+ To run the model for text generation, you will need to install the required dependencies. The included Mamba2 implementation relies on CUDA/Triton kernels and is intended to run on a CUDA-enabled GPU. Ampere-class GPUs or newer are recommended.
73
+
74
+ > **Note:** The model uses custom architecture code, so you must pass `trust_remote_code=True` when loading both the tokenizer and the model.
75
+
76
+ ### Installation
77
+
78
+ ```bash
79
+ pip install transformers huggingface_hub torch
80
+ pip install causal-conv1d mamba-ssm
81
+ ```
82
+
83
+ ### Generation
84
+
85
+ Here is a simple Python script to load the model and generate text interactively:
86
+
87
+ ```python
88
+ import torch
89
+ from transformers import AutoModelForCausalLM, AutoTokenizer
90
+
91
+ MODEL_ID = "basically-ai/Pebble-25M"
92
+
93
+
94
+ def main():
95
+ print("Loading Pebble 25M...")
96
+
97
+ tokenizer = AutoTokenizer.from_pretrained(
98
+ MODEL_ID,
99
+ trust_remote_code=True,
100
+ )
101
+
102
+ model = AutoModelForCausalLM.from_pretrained(
103
+ MODEL_ID,
104
+ trust_remote_code=True,
105
+ dtype=torch.float32,
106
+ ).to("cuda")
107
+
108
+ model.eval()
109
+
110
+ print(
111
+ f"Model loaded successfully! "
112
+ f"VRAM usage: {torch.cuda.memory_allocated() / 1e9:.2f} GB"
113
+ )
114
+ print("Type 'quit' or 'exit' to stop.\n")
115
+
116
+ while True:
117
+ prompt = input("You: ")
118
+
119
+ if prompt.lower() in ["quit", "exit"]:
120
+ break
121
+
122
+ # Tokenize the prompt
123
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
124
+
125
+ # Generate text
126
+ print("Pebble: ", end="", flush=True)
127
+
128
+ with torch.inference_mode():
129
+ outputs = model.generate(
130
+ **inputs,
131
+ max_new_tokens=100, # How many tokens to generate
132
+ do_sample=True, # Use sampling (more creative)
133
+ temperature=0.7, # Controls randomness
134
+ top_k=50, # Consider top 50 tokens
135
+ top_p=0.95, # Nucleus sampling
136
+ repetition_penalty=1.2, # Prevent repeating words
137
+ )
138
+
139
+ # Decode and print (skip the prompt part)
140
+ generated_text = tokenizer.decode(
141
+ outputs[0][inputs["input_ids"].shape[1]:],
142
+ skip_special_tokens=True,
143
+ )
144
+
145
+ print(generated_text)
146
+ print()
147
+
148
+
149
+ if __name__ == "__main__":
150
+ main()
151
+ ```
152
+
153
+ ## License
154
+
155
+ Apache 2.0