Skip to content

Instantly share code, notes, and snippets.

View wassname's full-sized avatar
🤖

wassname (Michael J Clark) wassname

🤖
View GitHub Profile
@wassname
wassname / minicache.py
Last active June 4, 2026 02:02
anycache for machine learning. wrap functions, and cache to disk
"""minicache — anycache-spirit single-file disk cache.
Why not anycache:
- in machine learning you can't has `model` so we have `exclude=["model", "tok"]``
- you sometimes want to cach `tensor` so we use cloudpickle and to compress if possible (TODO check it works)
- we add cloudpickle backend. Handles lambdas, closures, dataclasses, pandas,
jax pytrees, torch tensors — everything stdlib pickle chokes on.
Why not just `functools.lru_cache + pickle.dump`: same arg-hashing problem.
- gzip on disk. ~3× smaller files. cloudpickle output streams cleanly
through `gzip.open`, no extra tooling.
@wassname
wassname / guided.py
Last active June 3, 2026 04:00
Guided CoT Evaluation: Hybrid Teacher-Forced + On-Policy Reasoning
"""Reusable guided-rollout primitive: thinkforced-close-thinkJSON choice.
One rollout, three numbers. The same primitive backs:
- calibrate()'s coherence + format + rep measurement
- probe replay at edit time
- post-keep probe regeneration
- (future) DD eval (once _measure_logratios is ported to this)
Substrate:
<user_prompt + schema_hint>
@wassname
wassname / SKILL.md
Created May 25, 2026 01:19 — forked from aparente/SKILL.md
tufte-viz Claude Code skill — Edward Tufte data visualization principles

name: tufte-viz description: | Ideate and critique data visualizations using Edward Tufte's principles from "The Visual Display of Quantitative Information." Use this skill when: (1) Designing new data visualizations or charts (2) Critiquing or improving existing visualizations (3) Reviewing dashboards or reports for graphical integrity (4) Deciding between visualization approaches (5) Reducing chartjunk or improving data-ink ratio (6) Planning small multiples or high-density displays

# This is a blocklist to block samsung smart tv's sending meta data at home.
# Please help to collect domains!
# It could be that the TV does not receive any more updates or other services no longer work. Please report such an incident.
abtauthprd.samsungcloudsolution.com
acr0.samsungcloudsolution.com
ad.samsungadhub.com
ads.samsungads.com
amauthprd.samsungcloudsolution.com
api-hub.samsungyosemite.com
@wassname
wassname / logs.md
Last active April 26, 2026 02:28
Coding agent compatible logs. concise, inline guidance, token effecient

Principles

  • don't use many tokens
  • make it so a dumb summary LLM can easily 1) see problems 2) have clues to diagnose
  • timing information

example of good log

  • with single line should statement inline in log that make it clear how it should look, distinguish from subtle failures, and give principled clue for diagnosis
  • table short have longest and least important lines last, so that humans can read it even with wrap around e.g short numeric columns first. long text columns last, notes or desc last
  • use tabulate plain for token effecient, not logging each step or epoch but just table
@wassname
wassname / rep_pen.md
Created April 23, 2026 00:47
hf transformers repetition penalty
@wassname
wassname / justfile
Last active April 3, 2026 08:55
snippet showing how to do a smoke test including beartype and jaxtyping only on smoke test
# Smoke test: demo on task 0 showing steered outputs at -1, 0, +1
smoke *ARGS:
BEARTYPE=1 {{ PY }} ssteer_v3.py --quick {{ ARGS }} 2>&1 | tee /tmp/smoke.log | tail -80
@wassname
wassname / classify_linear_sublayers.py
Created April 3, 2026 08:55
classify_linear_sublayers as residual read or write
def classify_linear_sublayers(
model,
block_layers: list[str],
) -> dict[str, list[str]]:
"""Classify all Linear sublayers in each block by their residual-stream role.
For a Linear layer with weight shape [out_features, in_features]:
- residual_write : out_features == d_model (writes TO residual stream)
- residual_read : in_features == d_model (reads FROM residual stream)
@wassname
wassname / bwap_cuda_uv_fix.md
Created March 2, 2026 04:34
claude bubblewrap with cuda and uv

GPU + uv in Claude Code sandbox (Linux/NVIDIA)

Problem: Claude Code's sandbox (bubblewrap) blocks GPU devices and the uv package cache.

Solution: bwrap wrapper at ~/.local/bin/bwrap

@wassname
wassname / peft_adapter_papers.md
Last active February 22, 2026 10:12
PEFT Adapter papers

PEFT Adapter papers

Orthogonal methods: OFT, BOFT, HRA, ROAD, GOFT (Givens), OFTv2 Low-rank methods: LoRA, AdaLoRA, LoHa, LoKr, RandLoRA, VBLoRA, FourierFT, DeLoRA Scaling methods: IA3, VeRA Prompt-based: Prompt Tuning, Prefix Tuning, P-Tuning, Adaption Prompt, Multitask Prompt Tuning, CPT Specialized: MiSS, SHiRA, C3A, LN Tuning, Poly, XLoRA