InterDigitalInc / CompressAI

A PyTorch library and evaluation platform for end-to-end compression research
https://interdigitalinc.github.io/CompressAI/
BSD 3-Clause Clear License
1.15k stars 228 forks source link

fix: restore deprecated CompressionModel(entropy_bottleneck_channels) #248

Closed YodaEmbedding closed 1 year ago

YodaEmbedding commented 1 year ago

Some external projects that use CompressAI as an importable library may depend on CompressionModel to create the entropy_bottleneck. Thus, we restore this legacy behavior (but discourage its use via a warning).

DeprecationWarning: The entropy_bottleneck_channels parameter is deprecated. Create an entropy_bottleneck in your model directly instead:

class YourModel(CompressionModel):
    def __init__(self):
        super().__init__()
        self.entropy_bottleneck = EntropyBottleneck(entropy_bottleneck_channels)

Also fixes broken CI in https://github.com/InterDigitalInc/CompressAI/pull/248/commits/f90b6cb215e34c91c081b1ed5c13d9491df8c74d.