Skip to content

Commit 0888232

Browse files
authored
[Example] [Bugfix] Fix Gemma ignore list (#1531)
## Purpose ## * Fix invalid regexes, prevent the vision tower from being quantized ## Fixes ## * #1306 ## Changes ## * Add `model.` to beginning of ignore list * Because `"re:model\.vision_tower.*"` is a proper way to escape regex, but an improper way of escaping strings, `W605` triggers. Let's ignore this linting warning. * Remove flake8 configuration from toml file * Note that [flake8 is not configurable from toml file](https://pypi.org/project/Flake8-pyproject/#:~:text=Flake8%20cannot%20be%20configured%20via,central%20location%20for%20project%20configuration.), so these files are purely misleading * I'm not sure why E203 is ignored, so I think it's fine to not have an explicit reason given for ignoring W605 (a user can use git blame to find this PR) ## Testing ## * Ran gemma3 example --------- Signed-off-by: Kyle Sayers <[email protected]>
1 parent f0c5ca6 commit 0888232

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ quality:
2626
@echo "Running python quality checks";
2727
ruff check $(CHECKDIRS);
2828
isort --check-only $(CHECKDIRS);
29-
flake8 $(CHECKDIRS) --max-line-length 88 --extend-ignore E203;
29+
flake8 $(CHECKDIRS) --max-line-length 88 --extend-ignore E203,W605;
3030

3131
# style the code according to accepted standards for the repo
3232
style:
3333
@echo "Running python styling";
3434
ruff format $(CHECKDIRS);
3535
isort $(CHECKDIRS);
36-
flake8 $(CHECKDIRS) --max-line-length 88 --extend-ignore E203;
36+
flake8 $(CHECKDIRS) --max-line-length 88 --extend-ignore E203,W605;
3737

3838
# run tests for the repo
3939
test:

examples/multimodal_vision/gemma3_example.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ def data_collator(batch):
3131
GPTQModifier(
3232
targets="Linear",
3333
scheme="W4A16",
34-
ignore=["re:*.lm_head", "re:vision_tower.*", "re:multi_modal_projector.*"],
34+
ignore=[
35+
"lm_head",
36+
"re:model\.vision_tower.*",
37+
"re:model\.multi_modal_projector.*",
38+
],
3539
),
3640
]
3741

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ files = "src/guidellm"
1616
[tool.ruff]
1717
exclude = ["build", "dist", "env", ".venv", "src/llmcompressor/transformers/tracing/"]
1818
lint.select = ["E", "F", "W"]
19+
lint.extend-ignore = ["E203", "W605"]
1920

21+
# flake8 configuration is non-functional, only exists for vscode extensions
22+
# for the true flake8 configuration, see `Makefile`
2023
[tool.flake8]
2124
max-line-length = 88
22-
extend-ignore = 'E203'
25+
extend-ignore = ["E203", "W605"]
2326

2427
[tool.pytest.ini_options]
2528
markers = [

0 commit comments

Comments
 (0)