-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (125 loc) · 4.91 KB
/
Copy pathMakefile
File metadata and controls
150 lines (125 loc) · 4.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
MODEL ?= models/smollm2-135m-instruct-q4_k_m.gguf
PROMPT ?= Gravity is
TOKENS ?= 8
THREADS ?= 2
CTX ?= 256
TRACE_OUT ?= runs/latest-run.jsonl
RUNS_DIR ?= runs
FILE ?= $(RUNS_DIR)/fake-run.jsonl
DISCOVERY_OUT ?= $(RUNS_DIR)/tensor-discovery.tsv
.PHONY: help configure build lint model smoke advanced-smoke discover-tensors ask run run-logs \
telemetry-demo replay replay-real test-telemetry test-advanced-flags \
test-advanced-schema test-layer-timings \
test-activation-stats test-attention-matrix \
dashboard dashboard-fake dashboard-real \
clean
help:
@echo "Common commands:"
@echo " make build Configure and build ./build/trace"
@echo " make lint Run cpplint on src/"
@echo " make model Download the tiny local GGUF model"
@echo " make smoke Run a short safe local model test"
@echo " make advanced-smoke Run a short safe source-backed model test"
@echo " make discover-tensors Record llama.cpp cb_eval tensor metadata"
@echo " make ask Print only the local model output"
@echo " make run Run with PROMPT/TOKENS/THREADS/CTX overrides"
@echo " make run-logs Same as run, but show llama.cpp logs"
@echo " make telemetry-demo Write fake telemetry to runs/fake-run.jsonl"
@echo " make replay Replay runs/fake-run.jsonl"
@echo " make replay-real Replay the latest real LLM telemetry"
@echo " make test-telemetry Run safe real telemetry validation checks"
@echo " make test-advanced-flags Validate advanced CLI safety checks"
@echo " make test-advanced-schema Validate advanced JSONL schema replay"
@echo " make test-layer-timings Validate real layer/submodule timing rows"
@echo " make test-activation-stats Validate activation stats fixture and math"
@echo " make test-attention-matrix Validate attention matrix fixture and real capture"
@echo " make dashboard-fake Open TUI with fake demo data (no model needed)"
@echo " make dashboard-real Open TUI with the latest real telemetry run"
@echo " make dashboard Open TUI with FILE=<path> (default: runs/fake-run.jsonl)"
@echo " make clean Remove build artifacts"
@echo
@echo "Examples:"
@echo " make smoke"
@echo " make discover-tensors"
@echo " make ask PROMPT=\"Explain gravity simply\" TOKENS=64"
@echo " make run PROMPT=\"Explain gravity simply\" TOKENS=32"
@echo " make replay-real"
@echo " make test-telemetry"
@echo " make test-advanced-flags"
@echo " make test-advanced-schema"
@echo " make test-layer-timings"
@echo " make test-activation-stats"
@echo " make test-attention-matrix"
@echo " make dashboard-fake"
@echo " make dashboard FILE=runs/latest-run.jsonl"
configure:
cmake -S . -B build
build: configure
cmake --build build
lint:
cpplint --recursive src
model:
./scripts/download_smollm2_model.sh
smoke: build
./build/trace run --model "$(MODEL)" --prompt "Gravity is" --tokens 8 --threads 2 --ctx-size 256 --trace-out runs/smoke-run.jsonl
advanced-smoke: build
./build/trace run \
--model "$(MODEL)" \
--prompt "Gravity is" \
--tokens 4 \
--threads 2 \
--ctx-size 256 \
--trace-out runs/advanced-smoke.jsonl \
--advanced-trace \
--quiet
discover-tensors: build
./build/trace run \
--model "$(MODEL)" \
--prompt "Gravity is" \
--tokens 4 \
--threads 2 \
--ctx-size 256 \
--trace-out "$(RUNS_DIR)/tensor-discovery-run.jsonl" \
--advanced-trace \
--discover-tensors \
--capture-attention \
--capture-activations \
--capture-layers 0 \
--capture-heads 0 \
--capture-token-window 32 \
--activation-sample-limit 4096 \
--tensor-discovery-out "$(DISCOVERY_OUT)" \
--quiet
ask:
@./build/trace run --model "$(MODEL)" --prompt "$(PROMPT)" --tokens "$(TOKENS)" --threads "$(THREADS)" --ctx-size "$(CTX)" --trace-out "$(TRACE_OUT)" --quiet
run: build
./build/trace run --model "$(MODEL)" --prompt "$(PROMPT)" --tokens "$(TOKENS)" --threads "$(THREADS)" --ctx-size "$(CTX)" --trace-out "$(TRACE_OUT)"
run-logs: build
./build/trace run --model "$(MODEL)" --prompt "$(PROMPT)" --tokens "$(TOKENS)" --threads "$(THREADS)" --ctx-size "$(CTX)" --trace-out "$(TRACE_OUT)" --show-logs
telemetry-demo: build
./build/trace demo --out runs/fake-run.jsonl
replay: build
./build/trace replay --file runs/fake-run.jsonl
replay-real: build
./build/trace replay --file "$(TRACE_OUT)"
test-telemetry:
./scripts/check_real_telemetry.sh
test-advanced-flags:
bash ./scripts/check_advanced_flags.sh
test-advanced-schema:
bash ./scripts/check_advanced_schema.sh
test-layer-timings:
bash ./scripts/check_layer_timings.sh
test-activation-stats:
bash ./scripts/check_activation_stats.sh
test-attention-matrix:
bash ./scripts/check_attention_matrix.sh
dashboard-fake: build
@mkdir -p $(RUNS_DIR)
./build/trace dashboard
dashboard-real: build
./build/trace dashboard --file "$(TRACE_OUT)"
dashboard: build
./build/trace dashboard --file "$(FILE)"
clean:
rm -rf build