For this example, I was able to confirm that the documentation has been corrected in the new release:

The affected examples have been updated in Transformers 5.25.0. PR #51425 fixes the 19 English model documentation pages identified in #51096, and the change is included in the 5.25.0 release.

My static comparison of the English model documentation’s Python code blocks found 19 direct calls using the old "int4_weight_only" string in 5.24.1 and none in 5.25.0. I also checked the changes to all 19 files in the PR.

For anyone using an older copy of one of those examples, the replacement is:

from transformers import TorchAoConfig
from torchao.quantization import Int4WeightOnlyConfig

quantization_config = TorchAoConfig(
    Int4WeightOnlyConfig(group_size=128)
)

This preserves the original group size. In an otherwise compatible environment that already supports the object-based API, the snippet can be corrected locally without necessarily upgrading Transformers.

The fix is to the documentation: the old string API is still intentionally rejected. My additional verification here was of the documentation and source code, not a new runtime test of torchao or of all 19 models. The original constructor-level measurements are particularly useful because they isolate the problem before model loading.

For the original report, the main update is that the documentation correction has shipped in 5.25.0. The older examples can also be corrected locally in a compatible environment, and any subsequent backend or model-specific failure can be investigated separately.

原文来源:discuss.huggingface.co