Skip to content
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

Add quantization config option #433

Merged
merged 6 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mii/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def _parse_kwargs_to_model_config(

# Create the ModelConfig object and return it with remaining kwargs
model_config = ModelConfig(**model_config)

return model_config, remaining_kwargs


Expand Down
13 changes: 13 additions & 0 deletions mii/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ class ModelConfig(MIIConfigModel):
`inference_engine_config`.
"""

quantization_mode: Optional[str] = None
"""
The quantization mode in string format. The supported modes are as follows:
- 'wf6af16', weight-only quantization with FP6 weight and FP16 activation.
"""

inference_engine_config: RaggedInferenceEngineConfig = {}
"""
DeepSpeed inference engine config. This is automatically generated, but you
Expand Down Expand Up @@ -210,6 +216,13 @@ def propagate_tp_size(cls, values: Dict[str, Any]) -> Dict[str, Any]:
values.get("inference_engine_config").tensor_parallel.tp_size = tensor_parallel
return values

@root_validator
def propagate_quantization_mode(cls, values: Dict[str, Any]) -> Dict[str, Any]:
quantization_mode = values.get("quantization_mode")
values.get(
"inference_engine_config").quantization.quantization_mode = quantization_mode
return values

@root_validator
def check_replica_config(cls, values: Dict[str, Any]) -> Dict[str, Any]:
num_replica_config = len(values.get("replica_configs"))
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
asyncio
deepspeed>=0.13.0
deepspeed>=0.14.0
deepspeed-kernels
Flask-RESTful
grpcio
Expand Down