-
Notifications
You must be signed in to change notification settings - Fork 114
feat: enable quantization support for vLLM backend #374
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,16 +53,19 @@ def _load(self, model): | |
| model : str | ||
| Hugging Face style model name. Example: `Qwen/Qwen2.5-0.5B-Instruct` | ||
| """ | ||
| self.model = LLM( | ||
| model=model, | ||
| trust_remote_code=True, | ||
| dtype="float16", | ||
| tensor_parallel_size=self.tensor_parallel_size, | ||
| gpu_memory_utilization=self.gpu_memory_utilization, | ||
| max_model_len = 8192 | ||
| #quantization=self.quantization # TODO need to align with vllm API | ||
| ) | ||
|
|
||
| llm_kwargs = { | ||
| "model": model, | ||
| "trust_remote_code": True, | ||
| "dtype": "float16", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| "tensor_parallel_size": self.tensor_parallel_size, | ||
| "gpu_memory_utilization": self.gpu_memory_utilization, | ||
| "max_model_len": 8192 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| } | ||
|
|
||
| if self.quantization: | ||
| llm_kwargs["quantization"] = self.quantization | ||
|
|
||
| self.model = LLM(**llm_kwargs) | ||
| self.sampling_params = SamplingParams( | ||
| temperature=self.temperature, | ||
| top_p=self.top_p, | ||
|
|
||
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.
Hardcoding
trust_remote_code=Truecan pose a security risk, as it allows arbitrary code execution from the model's repository. It's highly recommended to make this a configurable parameter that defaults toFalse. Users should explicitly enable it only when they trust the source of the model.