MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / postprocess_transpose

Function postprocess_transpose

convert.py:1038–1048  ·  view source on GitHub ↗

Transpose ffn_down matrices for Axpy ops.

(model: LazyModel)

Source from the content-addressed store, hash-verified

1036 return out
1037
1038def postprocess_transpose(model: LazyModel) -> LazyModel:
1039 """Transpose ffn_down matrices for Axpy ops."""
1040 out: LazyModel = {}
1041
1042 for name, lazy_tensor in model.items():
1043 if name.endswith(".ffn_down.weight"):
1044 out[name.replace("ffn_down", "ffn_down_t")] = lazy_tensor.transposed()
1045 else:
1046 out[name] = lazy_tensor
1047
1048 return out
1049
1050def nth_multifile_path(path: Path, n: int) -> Path | None:
1051 '''Given any path belonging to a multi-file model (e.g. foo.bin.1), return

Callers 1

mainFunction · 0.85

Calls 1

transposedMethod · 0.80

Tested by

no test coverage detected