File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/compressed_tensors/compressors/model_compressors Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -177,12 +177,15 @@ def from_pretrained_model(
177
177
algorithm
178
178
:return: compressor for the configs, or None if model is not compressed
179
179
"""
180
- # assume multiple compression formats means mixed-precision
181
- # as we currently only support one compressor per precision type and scheme
180
+
182
181
if quantization_format is not None :
183
- if isinstance (quantization_format , str ):
182
+ # llmcompressor incorrectly passes in a CompressionFormat when
183
+ # the value string is expected - handle both cases
184
+ if isinstance (quantization_format , (str , CompressionFormat )):
184
185
quantization_format = [quantization_format ]
185
186
187
+ # assume multiple compression formats means mixed-precision
188
+ # as we currently only support one compressor per precision type and scheme
186
189
if len (quantization_format ) > 1 :
187
190
quantization_format = CompressionFormat .mixed_precision .value
188
191
else :
@@ -191,7 +194,6 @@ def from_pretrained_model(
191
194
quantization_config = QuantizationConfig .from_pretrained (
192
195
model , format = quantization_format
193
196
)
194
-
195
197
if isinstance (sparsity_config , str ): # we passed in a sparsity format
196
198
sparsity_config = SparsityCompressionConfig .load_from_registry (
197
199
sparsity_config
You can’t perform that action at this time.
0 commit comments