Skip to content

Commit df4d206

Browse files
authored
[Tracing] Copy HFTracer to support latest transformers (#1989)
## Background ## * huggingface/transformers#41683 remove some fx tracing utilities used by LLM Compressor's sequential pipeline capabilities ## Purpose ## * Allow LLM Compressor to support latest transformers ## Changes ## * Copied `src/transformers/utils/fx.py` (with copyright) * Use `trust_remote_code` for trace testing (the old deepseek model definitions are not supported with the latest transformers ## Testing ## * Used `test_models` to test that all models can still trace with transformers main * Quantized llama 8B e2e and confirmed sane outputs with transformers main --------- Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
1 parent e7a28ad commit df4d206

File tree

3 files changed

+1661
-2
lines changed

3 files changed

+1661
-2
lines changed

src/llmcompressor/pipelines/sequential/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
from torch.nn import Module
2020
from transformers import PreTrainedModel
2121
from transformers.configuration_utils import PretrainedConfig
22-
from transformers.utils.fx import HFTracer
2322

2423
from llmcompressor.modifiers import Modifier
2524
from llmcompressor.modifiers.utils.hooks import HooksMixin
25+
from llmcompressor.pipelines.sequential.transformers_helpers import HFTracer
2626
from llmcompressor.utils.helpers import calibration_forward_context, patch_attr
2727
from llmcompressor.utils.pytorch.module import get_no_split_params
2828

0 commit comments

Comments
 (0)