saudiwin commited on
Commit
2c51adf
·
verified ·
1 Parent(s): 1f0ab97

Add files using upload-large-folder tool

Browse files
Files changed (3) hide show
  1. README.md +106 -0
  2. model.pt +3 -0
  3. train_args.json +3 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: allenai/Olmo-3-7B-Instruct
4
+ library_name: pushpuppet
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - pushpuppet
8
+ - olmo3
9
+ - adaptive-inference
10
+ - structured-pruning
11
+ - elastic-model
12
+ ---
13
+
14
+ # PushPuppet · Olmo-3-7B-Instruct (post-RL)
15
+
16
+ A **push-puppet** checkpoint fitted on top of
17
+ [`allenai/Olmo-3-7B-Instruct`](https://huggingface.co/allenai/Olmo-3-7B-Instruct).
18
+
19
+ This is **not** a drop-in `transformers` model. It is a *gated* checkpoint: the
20
+ base network is augmented with learned per-unit gates (B-spline gate curves over
21
+ FFN neurons and attention heads) so that a **single** set of weights yields a
22
+ whole family of valid subnetworks, indexed by a compression control variable
23
+ **λ**. Raising λ prunes more units; the gates were trained (mid-train → SFT → RL)
24
+ so every rung of the ladder stays a usable model.
25
+
26
+ It is intended to be served by the
27
+ [PushPuppet adaptive runtime](https://github.com/saudiwin/pushpuppet_runtime),
28
+ which picks λ from available memory at runtime and serves the resulting
29
+ subnetwork over an OpenAI-compatible API.
30
+
31
+ ## Files
32
+
33
+ | File | Size | What it is |
34
+ |---|---|---|
35
+ | `model.pt` | ~27 GiB | Bare `torch.save` state dict, fp32, gates included |
36
+ | `train_args.json` | — | Records the base model id so the runtime can fetch config + tokenizer |
37
+
38
+ `model.pt` is a plain state dict (no config, no tokenizer). The runtime pulls
39
+ `config.json` and the tokenizer from the base repo named in `train_args.json`.
40
+
41
+ ## Architecture
42
+
43
+ Matches `allenai/Olmo-3-7B-Instruct` exactly, plus gate parameters:
44
+
45
+ | | |
46
+ |---|---|
47
+ | params | 7.30 B (fp32) |
48
+ | layers | 32 |
49
+ | hidden / intermediate | 4096 / 11008 |
50
+ | attention | 32 query / 32 KV heads (MHA), head_dim 128, per-head QK norm |
51
+ | vocab | 100278 |
52
+ | max context | 65536 (YaRN, ×8 over 8192) |
53
+
54
+ Push-puppet gate hyperparameters (inferable from the tensors, so you don't have
55
+ to supply them): `n_knots=8`, `degree=3`, per-head QK norm enabled,
56
+ `scale_output=true`.
57
+
58
+ ## Usage
59
+
60
+ ```bash
61
+ git clone https://github.com/saudiwin/pushpuppet_runtime
62
+ cd pushpuppet_runtime
63
+ uv sync --extra torch
64
+
65
+ scripts/download_model.sh # fetches this repo into models/olmo3_7b_instruct_post_rl
66
+ uv run pushpuppet up --ckpt-dir models/olmo3_7b_instruct_post_rl --lambda 1 --save
67
+ ```
68
+
69
+ The runtime then serves an OpenAI-compatible API on `http://localhost:11435/v1`
70
+ plus a live dashboard at `http://localhost:11435/`, where you can move λ up and
71
+ down and watch the footprint change.
72
+
73
+ At ~27 GiB the checkpoint trips the runtime's **disk-first** loader
74
+ automatically (threshold 20 GiB): the state dict is memory-mapped and the pruned
75
+ model is materialized one layer at a time, so peak RAM is roughly the *pruned*
76
+ model rather than the dense one. Default precision is bf16; add
77
+ `--quantize int8` to roughly halve it again.
78
+
79
+ ### Loading it yourself
80
+
81
+ You need the `push_puppet` research repo for the gate modules — the state dict
82
+ references `inject_stochastic_mlp` / `inject_stochastic_attn` parameters that
83
+ stock `transformers` does not define:
84
+
85
+ ```python
86
+ import torch, sys
87
+ from transformers import Olmo3Config, Olmo3ForCausalLM
88
+ sys.path.insert(0, "/path/to/push_puppet/python")
89
+ import olmo3_mini_train as train_mod
90
+
91
+ cfg = Olmo3Config.from_pretrained("allenai/Olmo-3-7B-Instruct")
92
+ model = Olmo3ForCausalLM(cfg)
93
+ train_mod.inject_stochastic_mlp(model, temperature=0.5, n_knots=8, degree=3)
94
+ train_mod.inject_stochastic_attn(model, temperature=0.5, n_knots=8, degree=3)
95
+ train_mod.inject_per_head_qk_norm(model)
96
+ model.load_state_dict(torch.load("model.pt", map_location="cpu", weights_only=True))
97
+ ```
98
+
99
+ Then call `structural_prune(model, lam)` to get a dense subnetwork at a given λ.
100
+
101
+ (`temperature=0.5` here is the **gate** temperature — the runtime's default, and
102
+ unrelated to sampling temperature at generation time.)
103
+
104
+ ## License
105
+
106
+ Apache 2.0, inherited from the base model `allenai/Olmo-3-7B-Instruct`.
model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c6912e6a08ebaeb253204749f4022c3dc39a4e3e3f3f54b08a329d0ea305f4f
3
+ size 29194731375
train_args.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "model_id": "allenai/Olmo-3-7B-Instruct"
3
+ }