[Core] RayWorkerVllm --> WorkerWrapper to reduce duplication (#4024)
[Core] replace narrow-usage RayWorkerVllm to general WorkerWrapper to reduce code duplication (#4024)
This commit is contained in:
+14
-2
@@ -271,8 +271,12 @@ def get_open_port() -> int:
|
||||
return s.getsockname()[1]
|
||||
|
||||
|
||||
def set_cuda_visible_devices(device_ids: List[int]) -> None:
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = ",".join(map(str, device_ids))
|
||||
def update_environment_variables(envs: Dict[str, str]):
|
||||
for k, v in envs.items():
|
||||
if k in os.environ:
|
||||
logger.warning(f"Overwriting environment variable {k} "
|
||||
f"from '{os.environ[k]}' to '{v}'")
|
||||
os.environ[k] = v
|
||||
|
||||
|
||||
def chunk_list(lst, chunk_size):
|
||||
@@ -505,3 +509,11 @@ def merge_dicts(dict1: Dict[Any, List[Any]],
|
||||
merged_dict[key].extend(value)
|
||||
|
||||
return dict(merged_dict)
|
||||
|
||||
|
||||
def init_cached_hf_modules():
|
||||
"""
|
||||
Lazy initialization of the Hugging Face modules.
|
||||
"""
|
||||
from transformers.dynamic_module_utils import init_hf_modules
|
||||
init_hf_modules()
|
||||
|
||||
Reference in New Issue
Block a user