derive: RADGRAM2 header is magic,k,rank,rows,domain (28 B)
This commit is contained in:
1 parent
de70320cde
commit
650dfff5a2
1 file changed
+1
-2
@@ -37,8 +37,7 @@ NAME_RE = re.compile(r"^gram\.r(\d)\.blk\.(\d+)\.ffn_down_exps\.(\d+)\.bin$")
|
|||||||
def read_gram(path):
|
def read_gram(path):
|
||||||
"""(k, rank, rows, trace) from a RADGRAM2 file (full matrix on disk)."""
|
"""(k, rank, rows, trace) from a RADGRAM2 file (full matrix on disk)."""
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
hdr = f.read(32)
|
magic, k, rank, rows, domain = struct.unpack("<8sIIQI", hdr[:28])
|
||||||
magic, k, rank, rows, domain = struct.unpack("<8sIIIQI", hdr[:32])
|
|
||||||
if magic != b"RADGRAM2":
|
if magic != b"RADGRAM2":
|
||||||
raise SystemExit(f"not a RADGRAM2 file: {path}")
|
raise SystemExit(f"not a RADGRAM2 file: {path}")
|
||||||
n = k * k
|
n = k * k
|
||||||
|
|||||||
Reference in new issue
Block a user