Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi episode with vllm_v2. #187

Merged
merged 2 commits into from
Dec 24, 2024
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: 1 addition & 2 deletions chatlearn/schedule/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ def sync_parameters(self, episode_offset=0, requires_grad=None, validate=False):
def set_func_decorator(self, model):
if is_decorated(model.name):
return
# decorate async method here will raise cannot serialize coroutine object error
call_funcs = model.call_funcs if not isinstance(model, VLLMModuleV2) else []
call_funcs = model.call_funcs
haolin-nju marked this conversation as resolved.
Show resolved Hide resolved

model_cls = model.__class__
for func_name in call_funcs:
Expand Down
7 changes: 4 additions & 3 deletions examples/megatron/models/vllm_policy_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@
"""vllm policy inference"""

import copy
import os
import random

import torch
import torch.nn.functional as F

from chatlearn.models.vllm import is_vllm_v2
from examples.megatron.data.prompt_dataset import VLLMPromptPipeline
from .utils import get_loss_mask

if os.environ.get("ENABLE_VLLM_V2"):
# pylint: disable=ungrouped-imports
if is_vllm_v2():
from chatlearn import VLLMModuleV2 as VLLMModule
else:
from chatlearn import VLLMModule

# pylint: enable=ungrouped-imports


class VLLMPolicyInference(VLLMModule):
Expand Down
Loading