FP8 PTQ With Physical Dependency 0515 #1875
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
描述:定义新的FP8 observer,目前只支持e4m3格式
功能:统计量化对象的abs_max,并根据abs_max和fp8格式的取值范围计算scale
PaddleSlim设计逻辑:
paddleslim/quant/observers/fp8uniform.py
定义FP8UniformObserverLayer类用以统计量化对象的abs_max以及根据用户选择的要量化到的FP8类型设置正确的量化区间,并最终计算出scale,方便FP8LinearQuanterDequanter进行量化和反量化操作
paddleslim/quant/observers/init.py
将FP8UniformObserver添加到__init__中方便外部调用