-
Notifications
You must be signed in to change notification settings - Fork 459
Support W8A8_dynamic on Step3 Model #3038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. |
There was a problem hiding this comment.
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 adds support for the Step3 model with W8A8 dynamic quantization. The changes include registering the new model and implementing a custom load_weights
method to handle the specific weight structure of MoE experts in this model. My main feedback is to avoid hardcoding the number of experts to improve the model's reusability.
experts_ = [f"experts.{i}.{proj}" for i in range(48) for proj in ("down_proj", "gate_proj", "up_proj")] | ||
|
||
packed_modules_mapping = { | ||
"qkv_proj": [ | ||
"q_proj", | ||
"k_proj", | ||
"v_proj", | ||
], | ||
"gate_up_proj":[ | ||
"gate_proj", | ||
"up_proj", | ||
], | ||
"experts": experts_ | ||
} | ||
|
||
def __init__( | ||
self, | ||
*, | ||
vllm_config: VllmConfig, | ||
prefix: str = "", | ||
): | ||
super().__init__(vllm_config=vllm_config, prefix="model") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The number of experts is hardcoded to 48, which limits this implementation to a specific model configuration. To support Step3Text
models with a varying number of experts, experts_
and packed_modules_mapping
should be initialized as instance attributes within __init__
. This allows dynamically setting the number of experts from the model configuration (self.model.config.moe_num_experts
).
def __init__(
self,
*,
vllm_config: VllmConfig,
prefix: str = "",
):
super().__init__(vllm_config=vllm_config, prefix="model")
num_experts = self.model.config.moe_num_experts
self.experts_ = [f"experts.{i}.{proj}" for i in range(num_experts) for proj in ("down_proj", "gate_proj", "up_proj")]
self.packed_modules_mapping = {
"qkv_proj": [
"q_proj",
"k_proj",
"v_proj",
],
"gate_up_proj": [
"gate_proj",
"up_proj",
],
"experts": self.experts_,
}
class CustomStep3TextForCausalLM(Step3TextForCausalLM): | ||
experts_ = [f"experts.{i}.{proj}" for i in range(48) for proj in ("down_proj", "gate_proj", "up_proj")] | ||
|
||
packed_modules_mapping = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be moved this to quant_config.py, after https://github.com/vllm-project/vllm-ascend/pull/3021/files is merged
###What this PR does / why we need it?
Support w8a8_dynamic for Step3 model
###Does this PR introduce any user-facing change?
No user-facing change
###How was this patch tested?
This patch is tested with following datasets:
MMMU: 73.11, MMSTAR: 70.68, AIME25: 80.00, GPQA-diamond: 72.73
###Modify points:
vLLM version: v0.10.2