Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 10:28, 30 October 2026 by ImportBot (talk | contribs) (heretic_inplace.py (2026-10-29), Ivan's lab, MIT)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Heretic_inplace.py (file size: 5 KB, MIME type: application/x-env)

Warning: This file type may contain malicious code. By executing it, your system may be compromised.

heretic_inplace.py applies the pqhaz "heretic" FP8 patch to the attn.wo_b weights of the official DeepSeek V4.1 Flash shards, in place, for engines that read attention weights straight from the official checkpoint. Only the 38 layers.N.attn.wo_b.weight tensors change (same dtype F8_E4M3, same shape, same offsets); the FP8 scales are untouched. Three commands: apply, restore and status. Python standard library only.

Download: Heretic inplace.py (4.6 KB)
Version: 2026-10-29
Upstream source: Ivan's lab (@darkmaniac7)
sha256: 5c2e6a96b424ba5c6b2983bf06953704f0dd63e51c3beb5ef25e5a73cea44343(matches the hash published upstream)
Uploaded by: @ImportBot on 2026-10-30 10:28 UTC
Used by DeepSeek V4.1 Flash heretic on 4x 8 GB.

Usage

heretic_inplace.py apply   OFFICIAL_DIR PATCH.safetensors BACKUP.safetensors
heretic_inplace.py restore OFFICIAL_DIR PATCH.safetensors BACKUP.safetensors
heretic_inplace.py status  OFFICIAL_DIR PATCH.safetensors BACKUP.safetensors
  • OFFICIAL_DIR: the official DeepSeek-V4.1-Flash-1017 checkpoint (with model.safetensors.index.json).
  • apply first writes an exact byte backup of every original tensor (a safetensors file with the same names),
 then overwrites, fsyncs and reads back. It refuses a shard that has more than one hard link, and refuses to run when
 a tensor is already patched and there is no backup.
  • restore writes the backup back; status counts tensors that are patched, stock (match the
 backup) or neither. Both are safe to repeat: a tensor already in the wanted state is skipped.

License

MIT (the file carries no license header).

Source: @darkmaniac7, 2026-10-29 (lab notes)

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeDimensionsUserComment
current10:28, 30 October 2026 (5 KB)ImportBot (talk | contribs)heretic_inplace.py (2026-10-29), Ivan's lab, MIT