-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[rollout] feat: add rollout config #3010
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
Changes from 6 commits
302575e
2dae82d
2fc4010
0a15ec9
b96a9e7
4f48025
aecc4c9
be4c6d5
7d0fe87
f71c4e4
270a6a9
800a16f
857b491
2c97e31
ae9bb34
f00cc1c
59af190
42de252
8888a9e
3ba18b9
7ba8881
f925b87
4488b74
af40044
7aad1bc
379a681
92a9e33
a92e921
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,141 @@ | ||||||||||||||
| # Copyright 2025 Bytedance Ltd. and/or its affiliates | ||||||||||||||
| # | ||||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||||
| # You may obtain a copy of the License at | ||||||||||||||
| # | ||||||||||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||
| # | ||||||||||||||
| # Unless required by applicable law or agreed to in writing, software | ||||||||||||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||
| # See the License for the specific language governing permissions and | ||||||||||||||
| # limitations under the License. | ||||||||||||||
|
|
||||||||||||||
| from dataclasses import dataclass, field | ||||||||||||||
|
|
||||||||||||||
| from verl.base_config import BaseConfig | ||||||||||||||
|
|
||||||||||||||
| __all__ = [ | ||||||||||||||
| "SamplingConfig", | ||||||||||||||
| "vLLMEngineConfig", | ||||||||||||||
| "SGLangEngineConfig", | ||||||||||||||
| "EngineConfig", | ||||||||||||||
| "MultiTurnConfig", | ||||||||||||||
| "CustomAsyncServerConfig", | ||||||||||||||
| "AgentLoopConfig", | ||||||||||||||
| "TraceConfig", | ||||||||||||||
| "RolloutConfig", | ||||||||||||||
| ] | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class SamplingConfig(BaseConfig): | ||||||||||||||
| temperature: float = 1.0 | ||||||||||||||
| top_k: int = -1 | ||||||||||||||
| top_p: float = 1.0 | ||||||||||||||
| do_sample: bool = True | ||||||||||||||
| n: int = 1 | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class vLLMEngineConfig(BaseConfig): | ||||||||||||||
| swap_space: int = None | ||||||||||||||
| disable_mm_preprocessor_cache: bool = True | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class SGLangEngineConfig(BaseConfig): | ||||||||||||||
| attention_backend: str = None | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class EngineConfig(BaseConfig): | ||||||||||||||
| vllm: vLLMEngineConfig = field(default_factory=vLLMEngineConfig) | ||||||||||||||
| sglang: SGLangEngineConfig = field(default_factory=SGLangEngineConfig) | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class MultiTurnConfig(BaseConfig): | ||||||||||||||
| enable: bool = False | ||||||||||||||
| max_assistant_turns: int = None | ||||||||||||||
| tool_config_path: str = None | ||||||||||||||
| max_user_turns: int = None | ||||||||||||||
| max_parallel_calls: int = 1 | ||||||||||||||
| max_tool_response_length: int = 256 | ||||||||||||||
| tool_response_truncate_side: str = "middle" | ||||||||||||||
| interaction_config_path: str = None | ||||||||||||||
| use_inference_chat_template: bool = False | ||||||||||||||
| tokenization_sanity_check_mode: str = "strict" | ||||||||||||||
| format: str = "hermes" | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class CustomAsyncServerConfig(BaseConfig): | ||||||||||||||
| path: str = None | ||||||||||||||
| name: str = None | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class AgentLoopConfig(BaseConfig): | ||||||||||||||
| num_workers: int = 8 | ||||||||||||||
| agent_loop_config_path: str = None | ||||||||||||||
| custom_async_server: CustomAsyncServerConfig = field(default_factory=CustomAsyncServerConfig) | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class TraceConfig(BaseConfig): | ||||||||||||||
| backend: str = None | ||||||||||||||
| token2text: bool = False | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @dataclass | ||||||||||||||
| class RolloutConfig(BaseConfig): | ||||||||||||||
| name: str | ||||||||||||||
| mode: str = "sync" | ||||||||||||||
|
|
||||||||||||||
| temperature: float = 1.0 | ||||||||||||||
| top_k: int = -1 | ||||||||||||||
| top_p: float = 1.0 | ||||||||||||||
| do_sample: bool = True | ||||||||||||||
| n: int = 1 | ||||||||||||||
|
Comment on lines
+83
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sampling parameters
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| prompt_length: int = 512 | ||||||||||||||
| response_length: int = 512 | ||||||||||||||
|
|
||||||||||||||
| dtype: str = "bfloat16" | ||||||||||||||
| gpu_memory_utilization: float = 0.5 | ||||||||||||||
| ignore_eos: bool = False | ||||||||||||||
| enforce_eager: bool = True | ||||||||||||||
| cudagraph_capture_sizes: list = None | ||||||||||||||
| free_cache_engine: bool = True | ||||||||||||||
| tensor_model_parallel_size: int = 2 | ||||||||||||||
| max_num_batched_tokens: int = 8192 | ||||||||||||||
|
|
||||||||||||||
| # TODO: enable train_kwargs | ||||||||||||||
| # train_sampling_config: SamplingConfig = field(default_factory=SamplingConfig) | ||||||||||||||
|
|
||||||||||||||
| val_kwargs: SamplingConfig = field(default_factory=SamplingConfig) | ||||||||||||||
|
|
||||||||||||||
| max_model_len: int = None | ||||||||||||||
| max_num_seqs: int = 1024 | ||||||||||||||
|
|
||||||||||||||
| # note that the logprob computation should belong to the actor | ||||||||||||||
| log_prob_micro_batch_size: int = None | ||||||||||||||
| log_prob_micro_batch_size_per_gpu: int = None | ||||||||||||||
| log_prob_use_dynamic_bsz: bool = False | ||||||||||||||
| log_prob_max_token_len_per_gpu: int = 16384 | ||||||||||||||
|
||||||||||||||
|
|
||||||||||||||
| disable_log_stats: bool = True | ||||||||||||||
|
|
||||||||||||||
| multi_stage_wake_up: bool = False | ||||||||||||||
| engine_kwargs: EngineConfig = field(default_factory=EngineConfig) | ||||||||||||||
|
|
||||||||||||||
| calculate_log_probs: bool = False | ||||||||||||||
|
|
||||||||||||||
| multi_turn: MultiTurnConfig = field(default_factory=MultiTurnConfig) | ||||||||||||||
|
|
||||||||||||||
| update_weights_bucket_megabytes: int = 512 | ||||||||||||||
|
|
||||||||||||||
| skip_rollout: bool = False | ||||||||||||||
| skip_dump_dir: str = "/tmp/rollout_dump" | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move rollout sampling params to
SamplingConfig?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I left a TODO. Currently, we don't want to introduce breaking changes. RolloutConfig should match rollout.yaml exactly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also want to remove the logprob bsz into actor.infer in the following PRs