feat(compression): add SpecBuilder for programmatic compression specs (#3133)

Add a fluent builder API for creating compression specifications
without writing YAML strings. This is useful in scripts and
Jupyter notebooks.

Example usage:
    spec = (compression.SpecBuilder()
        .add_tensor(subgraph=0, tensor=2)
            .with_lut(index_bitwidth=4)
        .build())

BUG=#3125

Co-authored-by: suleshahid <110432064+suleshahid@users.noreply.github.com>
This commit is contained in:
Ryan Kuester 2025-07-10 15:32:57 -05:00 committed by GitHub
parent 41a9c8a6c3
commit bbf70db499
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 239 additions and 1 deletions

View file

@ -61,6 +61,10 @@ def compression_test():
# with compressible tensors, but we verify the function is importable
assert callable(compression.compress)
# Test availability of the SpecBuilder
_ = (compression.SpecBuilder().add_tensor(
subgraph=0, tensor=0).with_lut(index_bitwidth=4).build())
return True