-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[sglang] feat: Add multi-interaction registry support and testing #2184
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
Conversation
logger.setLevel(os.getenv("VERL_LOGGING_LEVEL", "WARN")) | ||
|
||
|
||
def get_interaction_class(cls_name): |
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.
可以复用已有的 verl/tools/utils/tool_registry.py::get_tool_class 函数
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.
interaction and tool are different concepts. Interactions are playing user role which used in partial exposure/collaborative task, reflection task and workflow node training task.
return interaction_cls | ||
|
||
|
||
def initialize_interactions_from_config(interaction_config_file): |
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.
跟已有的 verl/tools/utils/tool_registry.py::initialize_tools_from_config 也有重复,能不能重构下已有的那个函数,让mcp也使用map的新格式?
if _req.interaction_kwargs: | ||
if _req.interaction_kwargs and self.interaction_map: | ||
interaction_kwargs = _req.interaction_kwargs | ||
await self.interaction.start_interaction(_req.request_id, **interaction_kwargs) |
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.
跟上面的代码也是重复的,可以合并成 get_ interaction 方法
…lcengine#2184) ### What does this PR do? > Add **concise** overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review. This PR implements multi-interaction support in SGLangRollout, enabling sample-level interaction selection similar to the existing tools system. The implementation includes a new interaction registry system that allows multiple named interactions to be configured and used within a single rollout instance. volcengine#1630 Core Implementation - New Interaction Registry System: Created verl/interactions/utils/interaction_registry.py with functions to dynamically load and manage multiple interaction instances from configuration files - Enhanced SGLangRollout: - Replaced single interaction attribute with interaction_map: dict[str, BaseInteraction] - Updated _initialize_interactions() method to support multiple interactions via registry - Modified interaction selection logic to use interaction_kwargs.name for sample-level binding - Configuration Updates: Added name field support in interaction config format with automatic name generation fallback Data Processing - Updated GSM8K Preprocessing: Modified examples/data_preprocess/gsm8k_multiturn_w_interaction.py to inject name field in interaction_kwargs - Enhanced Configuration: Updated examples/sglang_multiturn/config/interaction_config/gsm8k_interaction_config.yaml with explicit name field Testing & Quality - Comprehensive Test Suite: Added tests/interactions/test_interaction_registry.py with full coverage of registry functionality - Integration Tests: Created tests/workers/rollout/test_sglang_multi_interaction.py for multi-interaction scenarios - Updated Existing Tests: Modified existing interaction tests to support new name attribute and configuration format - Error Handling: Added validation for duplicate names, missing interactions, and edge cases Backward Compatibility - Graceful Degradation: When no interaction config is provided, system works without interactions (empty interaction_map) - Default Name Handling: Falls back to "gsm8k" when no name is specified in interaction_kwargs - Existing API Preservation: All existing interaction functionality remains unchanged Key Features 1. Sample-Level Selection: Each sample can specify which interaction to use via interaction_kwargs.name 2. Registry Pattern: Similar architecture to existing tools system for consistency 3. Automatic Naming: Intelligent name generation from class names (e.g., Gsm8kInteraction → gsm8k) 4. Duplicate Prevention: Runtime validation prevents naming conflicts 5. Flexible Configuration: Supports both explicit names and automatic derivation
…lcengine#2184) ### What does this PR do? > Add **concise** overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review. This PR implements multi-interaction support in SGLangRollout, enabling sample-level interaction selection similar to the existing tools system. The implementation includes a new interaction registry system that allows multiple named interactions to be configured and used within a single rollout instance. volcengine#1630 Core Implementation - New Interaction Registry System: Created verl/interactions/utils/interaction_registry.py with functions to dynamically load and manage multiple interaction instances from configuration files - Enhanced SGLangRollout: - Replaced single interaction attribute with interaction_map: dict[str, BaseInteraction] - Updated _initialize_interactions() method to support multiple interactions via registry - Modified interaction selection logic to use interaction_kwargs.name for sample-level binding - Configuration Updates: Added name field support in interaction config format with automatic name generation fallback Data Processing - Updated GSM8K Preprocessing: Modified examples/data_preprocess/gsm8k_multiturn_w_interaction.py to inject name field in interaction_kwargs - Enhanced Configuration: Updated examples/sglang_multiturn/config/interaction_config/gsm8k_interaction_config.yaml with explicit name field Testing & Quality - Comprehensive Test Suite: Added tests/interactions/test_interaction_registry.py with full coverage of registry functionality - Integration Tests: Created tests/workers/rollout/test_sglang_multi_interaction.py for multi-interaction scenarios - Updated Existing Tests: Modified existing interaction tests to support new name attribute and configuration format - Error Handling: Added validation for duplicate names, missing interactions, and edge cases Backward Compatibility - Graceful Degradation: When no interaction config is provided, system works without interactions (empty interaction_map) - Default Name Handling: Falls back to "gsm8k" when no name is specified in interaction_kwargs - Existing API Preservation: All existing interaction functionality remains unchanged Key Features 1. Sample-Level Selection: Each sample can specify which interaction to use via interaction_kwargs.name 2. Registry Pattern: Similar architecture to existing tools system for consistency 3. Automatic Naming: Intelligent name generation from class names (e.g., Gsm8kInteraction → gsm8k) 4. Duplicate Prevention: Runtime validation prevents naming conflicts 5. Flexible Configuration: Supports both explicit names and automatic derivation
…lcengine#2184) ### What does this PR do? > Add **concise** overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review. This PR implements multi-interaction support in SGLangRollout, enabling sample-level interaction selection similar to the existing tools system. The implementation includes a new interaction registry system that allows multiple named interactions to be configured and used within a single rollout instance. volcengine#1630 Core Implementation - New Interaction Registry System: Created verl/interactions/utils/interaction_registry.py with functions to dynamically load and manage multiple interaction instances from configuration files - Enhanced SGLangRollout: - Replaced single interaction attribute with interaction_map: dict[str, BaseInteraction] - Updated _initialize_interactions() method to support multiple interactions via registry - Modified interaction selection logic to use interaction_kwargs.name for sample-level binding - Configuration Updates: Added name field support in interaction config format with automatic name generation fallback Data Processing - Updated GSM8K Preprocessing: Modified examples/data_preprocess/gsm8k_multiturn_w_interaction.py to inject name field in interaction_kwargs - Enhanced Configuration: Updated examples/sglang_multiturn/config/interaction_config/gsm8k_interaction_config.yaml with explicit name field Testing & Quality - Comprehensive Test Suite: Added tests/interactions/test_interaction_registry.py with full coverage of registry functionality - Integration Tests: Created tests/workers/rollout/test_sglang_multi_interaction.py for multi-interaction scenarios - Updated Existing Tests: Modified existing interaction tests to support new name attribute and configuration format - Error Handling: Added validation for duplicate names, missing interactions, and edge cases Backward Compatibility - Graceful Degradation: When no interaction config is provided, system works without interactions (empty interaction_map) - Default Name Handling: Falls back to "gsm8k" when no name is specified in interaction_kwargs - Existing API Preservation: All existing interaction functionality remains unchanged Key Features 1. Sample-Level Selection: Each sample can specify which interaction to use via interaction_kwargs.name 2. Registry Pattern: Similar architecture to existing tools system for consistency 3. Automatic Naming: Intelligent name generation from class names (e.g., Gsm8kInteraction → gsm8k) 4. Duplicate Prevention: Runtime validation prevents naming conflicts 5. Flexible Configuration: Supports both explicit names and automatic derivation
What does this PR do?
This PR implements multi-interaction support in SGLangRollout, enabling sample-level interaction selection similar to the existing tools system. The implementation includes a new interaction registry system that allows multiple named
interactions to be configured and used within a single rollout instance. #1630
Core Implementation
Data Processing
Testing & Quality
Backward Compatibility
Key Features
Checklist Before Starting
[{modules}] {type}: {description}
(This will be checked by the CI){modules}
includefsdp
,megatron
,sglang
,vllm
,rollout
,trainer
,ci
,training_utils
,recipe
,hardware
,deployment
,ray
,worker
,single_controller
,misc
,perf
,model
,algo
,env
,tool
,ckpt
,doc
,data
,
like[megatron, fsdp, doc]
{type}
is infeat
,fix
,refactor
,chore
,test
[BREAKING]
to the beginning of the title.[BREAKING][fsdp, megatron] feat: dynamic batching
Test
API and Usage Example
Configuration (interaction_config.yaml):
interaction:
- name: "gsm8k"
class_name: "verl.interactions.gsm8k_interaction.Gsm8kInteraction"
config: {}
- name: "custom_solver"
class_name: "custom.interactions.CustomInteraction"
config: {"solver_type": "advanced"}
Data Sample:
High-Level Design
Specific Changes
Checklist Before Submitting
Important
Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.
pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=always
ci-request
channel in theverl
Slack workspace.