-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What this PR does / why we need it? This PR resolves the issue with inference on the Ray backend. For more details, see [here](#92). ### Does this PR introduce _any_ user-facing change? no. ### How was this patch tested? Validation was performed based on v0.7.3, and the specific validation script can be found [here](#92). --------- Signed-off-by: Chenguang Li <757486878@qq.com>
- Loading branch information
1 parent
b074047
commit 8a62c1f
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import torch_npu # noqa: F401 | ||
import vllm | ||
from vllm.executor.ray_utils import RayWorkerWrapper | ||
|
||
if RayWorkerWrapper is not None: | ||
|
||
class NPURayWorkerWrapper(RayWorkerWrapper): | ||
"""Importing torch_npu in other Ray processes through an empty class and | ||
a monkey patch. | ||
When Ray performs a remote call, it serializes the Task or Actor and passes | ||
it to the Worker process, where it is deserialized and executed. | ||
If no patch is applied, the default code of the RayWorkerWrapper provided | ||
by vLLM is used, which does not import torch_npu, causing an error in the | ||
Worker process. | ||
See https://github.com/vllm-project/vllm-ascend/pull/92. | ||
""" | ||
|
||
pass | ||
|
||
vllm.executor.ray_utils.RayWorkerWrapper = NPURayWorkerWrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters