Skip to content

[Example] GLM5.2 Example#2869

Draft
kylesayrs wants to merge 8 commits into
mainfrom
kylesayrs/glm5.2
Draft

[Example] GLM5.2 Example#2869
kylesayrs wants to merge 8 commits into
mainfrom
kylesayrs/glm5.2

Conversation

@kylesayrs

@kylesayrs kylesayrs commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a8b6cc50-1444-4cef-8880-2e4b79b0f3a8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kylesayrs/glm5.2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review.

Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed.

@mergify

mergify Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The quality checks have failed. Please run make style and make quality under
the root directory to adddress the lint failures. You will need to install the
dev optional install to get the required linting packages:
https://github.com/vllm-project/llm-compressor/blob/main/CONTRIBUTING.md

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for GLM-5 MoE quantization, refactors expert class mapping with lazy imports, deletes observer statistics to free memory, and adds a context manager to suspend distributed timeouts during model saving. Feedback focuses on potential issues with deleting observer statistics (which may cause redundant computations or memory leaks in fused observers), hardcoded user paths in the example script, a missing error message in a ValueError, and a potential hang risk when creating a new process group in suspend_distributed_timeout.

Comment thread src/llmcompressor/observers/base.py Outdated
Comment on lines +100 to +101
del fused_obs.min_vals
del fused_obs.max_vals

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Deleting fused_obs.min_vals and fused_obs.max_vals here will cause subsequent calls to get_qparams() on those fused observers to find has_statistics as False. This forces them to re-observe their weights (which is redundant and inefficient) or fail if they cannot be re-observed. It is safer and more efficient to let each observer manage the lifecycle of its own statistics and delete them only at the end of its own get_qparams() call.

Comment thread src/llmcompressor/observers/base.py Outdated
Comment on lines +113 to +114
del self.min_vals
del self.max_vals

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Deleting self.min_vals and self.max_vals here can lead to memory leaks and redundant computation when observers are fused. When a fused observer (e.g., obs2) is processed after self, it will see self.has_statistics as False and re-observe self's weight. This recreates self.min_vals and self.max_vals, which will then remain in memory indefinitely since get_qparams() has already run for self. Consider if deleting these statistics is truly necessary, or manage their cleanup globally after all quantization parameters have been computed.

Comment on lines +78 to +79
else:
raise ValueError()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Please provide a descriptive error message when raising ValueError to make debugging easier when an unsupported model_type is encountered.

Suggested change
else:
raise ValueError()
else:
raise ValueError(f"Unsupported model type: {model_type}")

Comment thread examples/quantizing_moe/glm5_example.py Outdated
model_id,
device_map="auto_offload",
max_memory={},
offload_folder="/mnt/nvme-data/engine/kylesayrs/offload_folder"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The offload folder path is hardcoded to a specific user's directory (/mnt/nvme-data/engine/kylesayrs/...). This makes the example script non-portable. Consider using a relative path, a standard temporary directory, or an environment variable.

Suggested change
offload_folder="/mnt/nvme-data/engine/kylesayrs/offload_folder"
offload_folder="offload_folder"

Comment thread examples/quantizing_moe/glm5_example.py Outdated
SAVE_DIR = model_id.rstrip("/").split("/")[-1] + "-W4A16-G128"
# Note: base checkpoint generation_config needs fixing for newer transformers versions
model.generation_config.top_p = None
SAVE_DIR = "/mnt/nvme-data/engine/kylesayrs/" + model_id.rstrip("/").split("/")[-1] + "-NVFP4"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The save directory path is hardcoded to a specific user's directory. Consider using a relative path or a generic directory.

Suggested change
SAVE_DIR = "/mnt/nvme-data/engine/kylesayrs/" + model_id.rstrip("/").split("/")[-1] + "-NVFP4"
SAVE_DIR = model_id.rstrip("/").split("/")[-1] + "-NVFP4"


if current_group is None:
current_group = dist.group.WORLD
suspend_group = dist.new_group(backend="gloo", timeout=timeout)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Note that dist.new_group is a collective operation that must be called by all processes in the default process group (WORLD), even if they are not part of the new group. If current_group is a subgroup and only a subset of ranks call suspend_distributed_timeout, this will cause a hang. Ensure that all ranks in the default process group enter this context manager.

@mergify mergify Bot removed the quality-failed label Jun 26, 2026
@mergify

mergify Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The quality checks have failed. Please run make style and make quality under
the root directory to adddress the lint failures. You will need to install the
dev optional install to get the required linting packages:
https://github.com/vllm-project/llm-compressor/blob/main/CONTRIBUTING.md

@kylesayrs kylesayrs changed the title [MoE] GLM5.2 Example [Example] GLM5.2 Example Jun 29, 2026
@mergify

mergify Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The quality checks have failed. Please run make style and make quality under
the root directory to adddress the lint failures. You will need to install the
dev optional install to get the required linting packages:
https://github.com/vllm-project/llm-compressor/blob/main/CONTRIBUTING.md

@mergify

mergify Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @kylesayrs.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Jul 6, 2026
kylesayrs added 8 commits July 7, 2026 15:58
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
@mergify mergify Bot added documentation Improvements or additions to documentation and removed quality-failed labels Jul 7, 2026
@mergify

mergify Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The quality checks have failed. Please run make style and make quality under
the root directory to adddress the lint failures. You will need to install the
dev optional install to get the required linting packages:
https://github.com/vllm-project/llm-compressor/blob/main/CONTRIBUTING.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation quality-failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant