Skip to content

tools.strip_mlir_weights

Source: tools/strip_mlir_weights.py

tools.strip_mlir_weights

Strip embedded weight data from MLIR files.

Removes the {-# dialect_resources: { builtin: { section and everything after it, which contains dense binary weight blobs that make files hundreds of megabytes. The resulting file keeps all ops, types, and structure intact and is small enough to load in an editor or script.

Usage

python tools/strip_mlir_weights.py [--suffix .stripped]

strip_file(path, suffix)

Strip weights from path, writing to path.with_suffix(suffix).

Returns the output path on success, None if no marker was found.