[Example] GLM5.2 Example#2869
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
👋 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. |
|
The quality checks have failed. Please run |
There was a problem hiding this comment.
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.
| del fused_obs.min_vals | ||
| del fused_obs.max_vals |
There was a problem hiding this comment.
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.
| del self.min_vals | ||
| del self.max_vals |
There was a problem hiding this comment.
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.
| else: | ||
| raise ValueError() |
| model_id, | ||
| device_map="auto_offload", | ||
| max_memory={}, | ||
| offload_folder="/mnt/nvme-data/engine/kylesayrs/offload_folder" |
There was a problem hiding this comment.
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.
| offload_folder="/mnt/nvme-data/engine/kylesayrs/offload_folder" | |
| offload_folder="offload_folder" |
| 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" |
There was a problem hiding this comment.
|
|
||
| if current_group is None: | ||
| current_group = dist.group.WORLD | ||
| suspend_group = dist.new_group(backend="gloo", timeout=timeout) |
There was a problem hiding this comment.
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.
|
The quality checks have failed. Please run |
|
The quality checks have failed. Please run |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
6d8793e to
0f332d8
Compare
|
The quality checks have failed. Please run |
Prerequisites
Accelerate/ Transformers
Compressed Tensors
apply_quantization_configcompressed-tensors#730load_offloaded_modelcompressed-tensors#728to_accelerateby only instantiatingOffloadedWeightsLoaderonce compressed-tensors#752LLM Compressor
vLLM