<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://cmp.wiki/w/index.php?action=history&amp;feed=atom&amp;title=File%3AHeretic_inplace.py</id>
	<title>File:Heretic inplace.py - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://cmp.wiki/w/index.php?action=history&amp;feed=atom&amp;title=File%3AHeretic_inplace.py"/>
	<link rel="alternate" type="text/html" href="https://cmp.wiki/w/index.php?title=File:Heretic_inplace.py&amp;action=history"/>
	<updated>2026-11-01T02:06:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://cmp.wiki/w/index.php?title=File:Heretic_inplace.py&amp;diff=533&amp;oldid=prev</id>
		<title>ImportBot: Wording: lab notes / site admins instead of a personal name</title>
		<link rel="alternate" type="text/html" href="https://cmp.wiki/w/index.php?title=File:Heretic_inplace.py&amp;diff=533&amp;oldid=prev"/>
		<updated>2026-10-31T21:36:15Z</updated>

		<summary type="html">&lt;p&gt;Wording: lab notes / site admins instead of a personal name&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;heretic_inplace.py&amp;#039;&amp;#039;&amp;#039; applies the pqhaz &amp;quot;heretic&amp;quot; FP8 patch to the &amp;lt;code&amp;gt;attn.wo_b&amp;lt;/code&amp;gt; weights of the official&lt;br /&gt;
DeepSeek V4.1 Flash shards, in place, for engines that read attention weights straight from the official checkpoint.&lt;br /&gt;
Only the 38 &amp;lt;code&amp;gt;layers.N.attn.wo_b.weight&amp;lt;/code&amp;gt; tensors change (same dtype F8_E4M3, same shape, same offsets); the&lt;br /&gt;
FP8 scales are untouched. Three commands: &amp;lt;code&amp;gt;apply&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;restore&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;. Python&lt;br /&gt;
standard library only.&lt;br /&gt;
&lt;br /&gt;
{{Download|version=2026-10-29|source=[https://cmp.wiki/wiki/User:Darkmaniac7 lab notes (@darkmaniac7)]|expected_sha256=5c2e6a96b424ba5c6b2983bf06953704f0dd63e51c3beb5ef25e5a73cea44343|notes=Used by [[DeepSeek V4.1 Flash heretic on 4x 8 GB]].}}&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
heretic_inplace.py apply   OFFICIAL_DIR PATCH.safetensors BACKUP.safetensors&lt;br /&gt;
heretic_inplace.py restore OFFICIAL_DIR PATCH.safetensors BACKUP.safetensors&lt;br /&gt;
heretic_inplace.py status  OFFICIAL_DIR PATCH.safetensors BACKUP.safetensors&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;OFFICIAL_DIR&amp;lt;/code&amp;gt;: the official DeepSeek-V4.1-Flash-1017 checkpoint (with &amp;lt;code&amp;gt;model.safetensors.index.json&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;lt;code&amp;gt;apply&amp;lt;/code&amp;gt; first writes an exact byte backup of every original tensor (a safetensors file with the same names),&lt;br /&gt;
  then overwrites, fsyncs and reads back. It refuses a shard that has more than one hard link, and refuses to run when&lt;br /&gt;
  a tensor is already patched and there is no backup.&lt;br /&gt;
* &amp;lt;code&amp;gt;restore&amp;lt;/code&amp;gt; writes the backup back; &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; counts tensors that are patched, stock (match the&lt;br /&gt;
  backup) or neither. Both are safe to repeat: a tensor already in the wanted state is skipped.&lt;br /&gt;
&lt;br /&gt;
== License ==&lt;br /&gt;
MIT (the file carries no license header).&lt;br /&gt;
&lt;br /&gt;
{{Source|darkmaniac7|2026-10-29|note=lab notes}}&lt;/div&gt;</summary>
		<author><name>ImportBot</name></author>
	</entry>
</feed>