Skip to content
Closed
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
4 changes: 3 additions & 1 deletion swift/rlhf_trainers/rollout_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from swift.template import Template
from swift.tuners import Swift
from swift.utils import (get_current_device, get_logger, is_deepspeed_enabled, is_vllm_available, remove_response,
to_device)
synchronize, to_device)
from .arguments import RolloutTrainerArgumentsMixin
from .rlhf_mixin import RLHFTrainerMixin
from .utils import (VLLM_LORA_INT_ID, VLLM_LORA_NAME, VLLM_LORA_PATH, FlattenedTensorBucket, TensorLoRARequest,
Expand Down Expand Up @@ -570,6 +570,8 @@ def _load_state_dict_to_vllm(self, state_dict):
# Patch MoE weight_loader if needed
patch_vllm_moe_model_weight_loader(llm_model)
llm_model.load_weights(state_dict.items())
# Keep ZeRO-3 gathered tensors valid until vLLM finishes any queued device copies.
synchronize()
del state_dict

def _fix_param_name_to_vllm(self, name: str, extra_prefixes: Optional[List[str]] = None) -> str:
Expand Down