Skip to content

Commit 3c8ff73

Browse files
Enable interactive debugging in llm-compressor by skipping self-references in locals (#1617)
If one tries to run interactive debugging session in e.g. VSCode, LLM-Compressor would crash with the following error: ``` ValueError: Some keys are not used by the HfArgumentParser: ['kwargs', 'local_args'] ``` This happens because dictionary `local_args = locals()` contains `local_args` and `kwargs` as keys (due to different execution context in debugpy compared to the standard "script mode" with `python quantize.py`), which HF argument parser in OneShot can't handle. This doesn't happens when LLM-Compressor is used in a "script mode" with `python quantize_my_model.py`. This patch makes it explicit that `local_args` and `kwargs` shouldn't be in local_args and makes interactive session with LLM-Compressor possible. --------- Co-authored-by: Brian Dellabetta <brian-dellabetta@users.noreply.github.com>
1 parent de8b1c5 commit 3c8ff73

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/llmcompressor/entrypoints/oneshot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,9 @@ def oneshot(
302302
"""
303303

304304
# pass all args directly into Oneshot
305-
local_args = locals()
306-
local_args.pop("kwargs")
305+
local_args = {
306+
k: v for k, v in locals().items() if k not in ("local_args", "kwargs")
307+
}
307308
one_shot = Oneshot(**local_args, **kwargs)
308309
one_shot()
309310

0 commit comments

Comments
 (0)