Skip to content

Commit

Permalink
[Bugfix] Add init_cached_hf_modules to RayWorkerWrapper (#4286)
Browse files Browse the repository at this point in the history
  • Loading branch information
DefTruth authored Apr 23, 2024
1 parent d3c8180 commit d87f39e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions vllm/executor/ray_gpu_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def _init_workers_ray(self, placement_group: "PlacementGroup",
)(RayWorkerWrapper).remote(
worker_module_name="vllm.worker.worker",
worker_class_name="Worker",
trust_remote_code=self.model_config.trust_remote_code,
)

worker_ip = ray.get(worker.get_node_ip.remote())
Expand All @@ -110,6 +111,7 @@ def _init_workers_ray(self, placement_group: "PlacementGroup",
self.driver_worker = RayWorkerWrapper(
worker_module_name="vllm.worker.worker",
worker_class_name="Worker",
trust_remote_code=self.model_config.trust_remote_code,
)
else:
# Else, added to the list of workers.
Expand Down
7 changes: 6 additions & 1 deletion vllm/worker/worker_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ class WorkerWrapperBase:

def __init__(self,
worker_module_name=None,
worker_class_name=None) -> None:
worker_class_name=None,
trust_remote_code: bool = False) -> None:
self.worker_module_name = worker_module_name
self.worker_class_name = worker_class_name
self.worker = None
if trust_remote_code:
# note: lazy import to avoid importing torch before initializing
from vllm.utils import init_cached_hf_modules
init_cached_hf_modules()

@staticmethod
def update_environment_variables(envs: Dict[str, str]) -> None:
Expand Down

0 comments on commit d87f39e

Please sign in to comment.