Skip to content
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
3 changes: 2 additions & 1 deletion docs/advance/fsdp_extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ vLLM, follow the guide of gemma model below:
param = params_dict[name]
weight_loader = getattr(param, "weight_loader",
default_weight_loader)
weight_loader(param, loaded_weight)
- weight_loader(param, loaded_weight)
+ weight_loader(param, local_loaded_weight.to(dtype=param.dtype))
loaded_params.add(name)
unloaded_params = params_dict.keys() - loaded_params
if unloaded_params:
Expand Down
10 changes: 4 additions & 6 deletions verl/third_party/vllm/vllm_v_0_4_2/llm_engine_sp.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,10 @@ def from_engine_args(
"Currently, the vllm in verl only support running on GPU"

if engine_config.parallel_config.world_size == 1:
# TODO: may also need to init process group
from vllm.executor.gpu_executor import GPUExecutor
executor_class = GPUExecutor
else:
from .spmd_gpu_executor import SPMDGPUExecutor
executor_class = SPMDGPUExecutor
engine_config.load_config.load_format = "dummy_hf"

from .spmd_gpu_executor import SPMDGPUExecutor
executor_class = SPMDGPUExecutor

# Create the LLM engine.
engine = cls(
Expand Down
32 changes: 6 additions & 26 deletions verl/third_party/vllm/vllm_v_0_5_4/llm_engine_sp.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,29 +279,14 @@ def free_cache_engine(self):
# The GPUExecutor remove the Ray dependency
@classmethod
def _get_executor_cls(cls, engine_config: EngineConfig) -> Type[ExecutorBase]:
distributed_executor_backend = (engine_config.parallel_config.distributed_executor_backend)
# Initialize the cluster and specify the executor class.]
# Initialize the cluster and specify the executor class.
assert engine_config.device_config.device_type == "cuda", \
"Currently, the vllm in verl only support running on GPU"

if engine_config.parallel_config.world_size == 1:
# TODO: may also need to init process group
from vllm.executor.gpu_executor import GPUExecutor
executor_class = GPUExecutor
else:
from .spmd_gpu_executor import SPMDGPUExecutor
executor_class = SPMDGPUExecutor
# elif distributed_executor_backend == "mp":
# from vllm.executor.multiproc_gpu_executor import (
# MultiprocessingGPUExecutor)
# assert not envs.VLLM_USE_RAY_SPMD_WORKER, (
# "multiprocessing distributed executor backend does not "
# "support VLLM_USE_RAY_SPMD_WORKER=1")
# executor_class = MultiprocessingGPUExecutor
# else:
# from vllm.executor.gpu_executor import GPUExecutor
# executor_class = GPUExecutor
engine_config.load_config.load_format = "dummy_hf"

from .spmd_gpu_executor import SPMDGPUExecutor
executor_class = SPMDGPUExecutor
return executor_class

@classmethod
Expand All @@ -321,13 +306,8 @@ def from_engine_args(
assert engine_config.device_config.device_type == "cuda", \
"Currently, the vllm in verl only support running on GPU"

if engine_config.parallel_config.world_size == 1:
# TODO: may also need to init process group
from vllm.executor.gpu_executor import GPUExecutor
executor_class = GPUExecutor
else:
from .spmd_gpu_executor import SPMDGPUExecutor
executor_class = SPMDGPUExecutor
from .spmd_gpu_executor import SPMDGPUExecutor
executor_class = SPMDGPUExecutor

# Create the LLM engine.
engine = cls(
Expand Down
2 changes: 2 additions & 0 deletions verl/trainer/ppo/workers/fsdp_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ def _build_rollout(self):
tokenizer=self.tokenizer,
model_hf_config=self.actor_model_config)
log_gpu_memory_usage('After building vllm rollout', logger=None)
if torch.distributed.get_world_size() == 1:
self.config.rollout.load_format = 'dummy_hf'
sharding_manager = FSDPVLLMShardingManager(module=self.actor_module_fsdp,
inference_engine=rollout.inference_engine,
model_config=self.actor_model_config,
Expand Down