Skip to content

Feat/qwen3.5 fp8toint8 - #1212

Open
1235v wants to merge 20 commits into
flagos-ai:mainfrom
1235v:feat/qwen3.5_fp8toint8
Open

Feat/qwen3.5 fp8toint8#1212
1235v wants to merge 20 commits into
flagos-ai:mainfrom
1235v:feat/qwen3.5_fp8toint8

Conversation

@1235v

@1235v 1235v commented Jun 2, 2026

Copy link
Copy Markdown

FP8 → INT8 Quantization Pipeline

This PR introduces a data-free FP8-to-INT8 conversion pipeline. It automatically dequantizes block-wise FP8 weights to BF16, then applies W8A8 PTQ via llmcompressor, producing an INT8 checkpoint ready for end-to-end inference.


How It Works

  • Dequantize FP8 weights (block-wise weight × scale) → temporary BF16 checkpoint
  • Apply W8A8 PTQ via llmcompressor (model_free_ptq) on the BF16 model
  • Save INT8 checkpoint, auto-cleanup temporary files

Validated Models

Model Type FP8 Granularity
Qwen3.5-27B-FP8 Dense Block-wise (128×128)
Qwen3.5-35B-A3B-FP8 MoE Block-wise (128×128)
Qwen3.6-27B-FP8 Dense Block-wise (128×128)
Qwen3-30B-A3B-FP8 MoE Block-wise (128×128)
GLM-4.5-Air-FP8 MoE Block-wise (128×128)
Deepseek-coder-v2-lite-instruct-FP8 MoE Per-tensor
Llama-3.1-8B-Instruct-FP8-dynamic Dense Per-channel
  • 7 models, 3 FP8 granularities (block-wise / per-channel / per-tensor), full coverage of Dense, MoE, and multimodal architectures, all verified with end-to-end inference.

How to Use FP8TOINT8 Quantization

cd FlagScale

# Quantization command
python run.py --config-path examples/qwen35/conf/inference --config-name compress_fp8toint8 \
    experiment.envs.MODEL_ID=/path/to/fp8_model \
    experiment.envs.SAVE_DIR=/path/to/output

tail -f outputs/fp8toint8_example/compress_logs/host_0_localhost.output

# End-to-end inference command
CUDA_VISIBLE_DEVICES=4,5,6,7 HIP_VISIBLE_DEVICES=4,5,6,7 vllm serve \
    ./models \
    --tensor-parallel-size 4 \
    --max-model-len 262144 \
    --port 8001 \
    --no-enable-log-requests \
    --no-enable-prefix-caching

@1235v
1235v requested review from aoyulong and ceci3 as code owners June 2, 2026 08:19
Comment thread flagscale/compress/qwen3.5_fp8_to_int8.py Outdated
Comment thread flagscale/compress/compressor.py Outdated
@cyber-pioneer

Copy link
Copy Markdown
Collaborator

Add usage doc

@cyber-pioneer

Copy link
Copy Markdown
Collaborator

remove chinese

tengqm and others added 7 commits July 18, 2026 19:16
…#1240)

Add standard Apache 2.0 copyright header (Copyright 2026 FlagOS
Contributors) to all source files.

- **703 files** stamped with Apache 2.0 headers
- **80 files** with upstream copyright (HuggingFace, Physical
Intelligence, NVIDIA) — left untouched
- **104 files** with other licenses (51 MPL, 41 proprietary, 10 MIT, 2
BSD) — third-party/upstream code
- **31 files** skipped by rule — binary, JSON, etc.

This PR was written in part with the assistance of generative AI.
…. 2026/7/21 (flagos-ai#1244)

<!--
 Copyright 2026 FlagOS Contributors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->

### PR Category
<!-- One of [ Train | Inference | Compress | Serve | RL | Core |
Hardware | CICD | Tools | Others ] -->
[CICD]
### PR Types
<!-- One of [ User Experience | New Features | Bug Fixes | Improvements
| Performance | Breaking Change| Deprecations | Test Case | Docs |
Others ] -->
Test Case
### PR Description
<!-- Describe what you’ve done -->
update  golden value of functional_test hetero_train and train.
### PR Category
<!-- One of [ Train | Inference | Compress | Serve | RL | Core |
Hardware | CICD | Tools | Others ] -->
Train
### PR Types
<!-- One of [ User Experience | New Features | Bug Fixes | Improvements
| Performance | Breaking Change| Deprecations | Test Case | Docs |
Others ] -->
Others
### PR Description
<!-- Describe what you’ve done -->
Update qwen3vl for the current `Megatron-LM-FL` and add functional
tests.
ceci3
ceci3 previously approved these changes Jul 23, 2026
Comment thread flagscale/compress/adapter.py Outdated
if self.is_mix_precision:

from llmcompressor.pipelines.registry import CalibrationPipeline
#pipeline_cls = CalibrationPipeline.load("mix_precision_search")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please remove commented-out code. If you need to document why the approach changed, add a comment explaining the reason.

@tengqm
tengqm dismissed ceci3’s stale review July 25, 2026 11:22

The merge-base changed after approval.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants