[data] feat: TransferQueue - Add zero-copy serialization support & usage improvement#4429
Conversation
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
There was a problem hiding this comment.
Code Review
This pull request updates the TransferQueue dependency to version 0.1.3.dev5. This is a positive step towards integrating new features like zero-copy serialization and an improved async_put method. However, my review highlights a concern with using a development (.dev) version of a dependency, which poses a stability risk. I have added comments recommending a switch to a stable release if possible. Furthermore, while this PR updates the dependency, the new features described in the PR description do not appear to be utilized yet in the existing codebase (e.g., in verl/utils/transferqueue_utils.py). I suggest creating a follow-up task to adopt these improvements to fully leverage the updated dependency.
There was a problem hiding this comment.
Pull request overview
This PR upgrades the TransferQueue dependency from version 0.1.2.dev0 to 0.1.3.dev5, enabling zero-copy serialization support and improved API functionality.
Key Changes:
- Updated TransferQueue version to 0.1.3.dev5 across all dependency specifications
- Enables zero-copy serialization through environment variable configuration
- Returns BatchMeta object from async_put() calls for improved user experience
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| setup.py | Updated TRANSFERQUEUE_REQUIRES to version 0.1.3.dev5 |
| requirements_transferqueue.txt | Updated TransferQueue package version to 0.1.3.dev5 |
| .github/workflows/e2e_transferqueue.yml | Updated TransferQueue installation version in both FSDP and Megatron test jobs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
| log_file="${log_dir}/qwen3-8b_tq_${timestamp}.log" | ||
|
|
||
| # You may try to enable zero-copy serialization for TransferQueue when using SimpleStorageUnit backend. | ||
| export TQ_ZERO_COPY_SERIALIZATION=False |
There was a problem hiding this comment.
Is there a side-effect when TQ_ZERO_COPY_SERIALIZATION=True? Can we always enable it?
There was a problem hiding this comment.
Enable zero copy serialization will lead to a slightly higher deserialization cost since we need to deserialize each tensor in a loop. For nested tensors in torch.strided layout, we also need to reconstruct the nested tensor during deserialization.
There was a problem hiding this comment.
In our experiment, enable TQ_ZERO_COPY_SERIALIZATION=True will slightly decrease the throughput for small tensors. So we still use False as default setting for now.
Refer to:
https://www.yuque.com/haomingzi-lfse7/hlx5g0/asmgy8hp5535bxu3?singleDoc#
| @@ -1,2 +1,2 @@ | |||
| # requirements.txt records the full set of dependencies for development | |||
| TransferQueue==0.1.2.dev0 | |||
There was a problem hiding this comment.
There's no need a separate requirements_transferqueue.txt since we already set it in setup.py.
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
72a06db to
b68ac8e
Compare
34df346 to
319396d
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…age improvement (verl-project#4429) ### What does this PR do? 1. Support zero-copy serialization for SimpleUnit backend through environment variable `TQ_ZERO_COPY_SERIALIZATION`. TransferQueue/TransferQueue#121 2. When calling `tq_client.async_put()`, TQ will return the updated `BatchMeta` object to the user. This will improve user experience when using TQ. TransferQueue/TransferQueue#119 3. Add log for transferqueue_utils.py 4. Add new BatchMeta operations to simplify single-controller usage ### Checklist Before Starting - [x] Search for similar PRs. Paste at least one query link here: ... - [x] Format the PR title as `[{modules}] {type}: {description}` (This will be checked by the CI) - `{modules}` include `fsdp`, `megatron`, `sglang`, `vllm`, `rollout`, `trainer`, `ci`, `training_utils`, `recipe`, `hardware`, `deployment`, `ray`, `worker`, `single_controller`, `misc`, `perf`, `model`, `algo`, `env`, `tool`, `ckpt`, `doc`, `data` - If this PR involves multiple modules, separate them with `,` like `[megatron, fsdp, doc]` - `{type}` is in `feat`, `fix`, `refactor`, `chore`, `test` - If this PR breaks any API (CLI arguments, config, function signature, etc.), add `[BREAKING]` to the beginning of the title. - Example: `[BREAKING][fsdp, megatron] feat: dynamic batching` ### Test > For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc. ### API and Usage Example > Demonstrate how the API changes if any, and provide usage example(s) if possible. ```python # Add code snippet or script demonstrating how to use this ``` ### Design & Code Changes > Demonstrate the high-level design if this PR is complex, and list the 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. - [x] Read the [Contribute Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md). - [x] Apply [pre-commit checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting): `pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=always` - [x] Add / Update [the documentation](https://github.com/volcengine/verl/tree/main/docs). - [x] Add unit or end-to-end test(s) to [the CI workflow](https://github.com/volcengine/verl/tree/main/.github/workflows) to cover all the code. If not feasible, explain why: ... - [ ] Once your PR is ready for CI, send a message in [the `ci-request` channel](https://verl-project.slack.com/archives/C091TCESWB1) in [the `verl` Slack workspace](https://join.slack.com/t/verl-project/shared_invite/zt-3855yhg8g-CTkqXu~hKojPCmo7k_yXTQ). (If not accessible, please try [the Feishu group (飞书群)](https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=772jd4f1-cd91-441e-a820-498c6614126a).) --------- Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
…age improvement (verl-project#4429) ### What does this PR do? 1. Support zero-copy serialization for SimpleUnit backend through environment variable `TQ_ZERO_COPY_SERIALIZATION`. TransferQueue/TransferQueue#121 2. When calling `tq_client.async_put()`, TQ will return the updated `BatchMeta` object to the user. This will improve user experience when using TQ. TransferQueue/TransferQueue#119 3. Add log for transferqueue_utils.py 4. Add new BatchMeta operations to simplify single-controller usage ### Checklist Before Starting - [x] Search for similar PRs. Paste at least one query link here: ... - [x] Format the PR title as `[{modules}] {type}: {description}` (This will be checked by the CI) - `{modules}` include `fsdp`, `megatron`, `sglang`, `vllm`, `rollout`, `trainer`, `ci`, `training_utils`, `recipe`, `hardware`, `deployment`, `ray`, `worker`, `single_controller`, `misc`, `perf`, `model`, `algo`, `env`, `tool`, `ckpt`, `doc`, `data` - If this PR involves multiple modules, separate them with `,` like `[megatron, fsdp, doc]` - `{type}` is in `feat`, `fix`, `refactor`, `chore`, `test` - If this PR breaks any API (CLI arguments, config, function signature, etc.), add `[BREAKING]` to the beginning of the title. - Example: `[BREAKING][fsdp, megatron] feat: dynamic batching` ### Test > For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc. ### API and Usage Example > Demonstrate how the API changes if any, and provide usage example(s) if possible. ```python # Add code snippet or script demonstrating how to use this ``` ### Design & Code Changes > Demonstrate the high-level design if this PR is complex, and list the 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. - [x] Read the [Contribute Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md). - [x] Apply [pre-commit checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting): `pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=always` - [x] Add / Update [the documentation](https://github.com/volcengine/verl/tree/main/docs). - [x] Add unit or end-to-end test(s) to [the CI workflow](https://github.com/volcengine/verl/tree/main/.github/workflows) to cover all the code. If not feasible, explain why: ... - [ ] Once your PR is ready for CI, send a message in [the `ci-request` channel](https://verl-project.slack.com/archives/C091TCESWB1) in [the `verl` Slack workspace](https://join.slack.com/t/verl-project/shared_invite/zt-3855yhg8g-CTkqXu~hKojPCmo7k_yXTQ). (If not accessible, please try [the Feishu group (飞书群)](https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=772jd4f1-cd91-441e-a820-498c6614126a).) --------- Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
What does this PR do?
TQ_ZERO_COPY_SERIALIZATION. [4/4][serialization] Perf: support non-jagged nested tensor for zero-copy serialization in SimpleUnit backend TransferQueue/TransferQueue#121tq_client.async_put(), TQ will return the updatedBatchMetaobject to the user. This will improve user experience when using TQ. [Feat] Update BatchMeta after calling put TransferQueue/TransferQueue#119Checklist 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 batchingTest
API and Usage Example
# Add code snippet or script demonstrating how to use thisDesign & Code 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=alwaysci-requestchannel in theverlSlack workspace. (If not accessible, please try the Feishu group (飞书群).)