Add model_free_ptq example for glm 4.6 block fp8#2343
Conversation
Signed-off-by: mgoin <mgoin64@gmail.com>
Summary of ChangesHello @mgoin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new example script that showcases the application of model-free post-training quantization (PTQ) using the FP8-Block scheme to the GLM-4.6 model. The primary goal is to provide a clear demonstration of how to quantize this specific model, including the configuration for ignoring certain layers, thereby enabling users to achieve efficient model compression. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
👋 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. |
There was a problem hiding this comment.
Code Review
This pull request adds a new example script for model-free post-training quantization on the GLM-4.6 model using an FP8 block scheme. The changes are clear and follow the pattern of existing examples. I've suggested a small improvement to make the save directory path construction more robust and readable by using os.path.basename.
| from llmcompressor import model_free_ptq | ||
|
|
There was a problem hiding this comment.
| from llmcompressor import model_free_ptq | ||
|
|
||
| MODEL_ID = "zai-org/GLM-4.6" | ||
| SAVE_DIR = MODEL_ID.rstrip("/").split("/")[-1] + "-FP8-BLOCK" |
There was a problem hiding this comment.
For better readability and robustness when parsing the model path, it's recommended to use os.path.basename to extract the model name. This avoids manual string splitting and is generally safer for handling paths.
| SAVE_DIR = MODEL_ID.rstrip("/").split("/")[-1] + "-FP8-BLOCK" | |
| SAVE_DIR = os.path.basename(MODEL_ID.rstrip("/")) + "-FP8-BLOCK" |
|
FYI - we have an example already https://github.com/vllm-project/llm-compressor/blob/main/examples/quantizing_moe/glm4_7_example.py |
SUMMARY:
Adapt the Kimi K2 example for GLM 4.6
TEST PLAN:
Checkpoint uploaded to: https://huggingface.co/mgoin/GLM-4.6-FP8-BLOCK