Skip to content

Add task_count#307

Merged
pan-x-c merged 3 commits intoagentscope-ai:mainfrom
hiyuchang:dev/add_metric
Oct 13, 2025
Merged

Add task_count#307
pan-x-c merged 3 commits intoagentscope-ai:mainfrom
hiyuchang:dev/add_metric

Conversation

@hiyuchang
Copy link
Collaborator

Description

[Please describe the background, purpose, changes made, and how to test this PR]

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hiyuchang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the training process by adding a new metric, task_count, to the trainer. This metric provides valuable insight into the diversity of tasks being handled in each training step, which can aid in monitoring and understanding the training dynamics without altering the core training logic.

Highlights

  • New Metric Added: Introduced a new metric named task_count within the train_step function in trinity/trainer/trainer.py.
  • Task Uniqueness Tracking: The task_count metric calculates the number of unique tasks processed during a training step by counting distinct task attributes from the eids in the exps object.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a task_count metric during the training step. The logic for calculating the number of unique tasks is correct. However, there's a minor issue with the order of metric updates that could cause the new task_count to be overwritten. I've provided a suggestion to fix this potential bug and slightly improve performance.

@pan-x-c
Copy link
Collaborator

pan-x-c commented Oct 13, 2025

/unittest-module-trainer

@github-actions
Copy link

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
20 17 1 2 0 0 2.0s

Failed Tests

Failed Tests ❌ Fail Message
❌ tests/trainer/trainer_test.py::TestTrainerLoRA::test_trainer The test failed in the call phase due to an assertion error

Skipped

Tests Status
tests/trainer/trainer_test.py::TestMultiModalGRPO::test_trainer skipped ⏭️
tests/trainer/trainer_test.py::TestMultiModalSFT::test_trainer skipped ⏭️

Tests

Test Name Status Flaky Duration
tests/trainer/trainer_test.py::TestTrainerCountdown_0_fsdp::test_trainer 137ms
tests/trainer/trainer_test.py::TestTrainerCountdown_1_megatron::test_trainer 323ms
tests/trainer/trainer_test.py::TestStepAheadAsyncRL::test_trainer 61ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_0_fsdp::test_trainer 59ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_1_fsdp2::test_trainer 53ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_2_fsdp::test_trainer 59ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_3_fsdp2::test_trainer 62ms
tests/trainer/trainer_test.py::TestTrainerSFTWarmupGSM8K::test_trainer 104ms
tests/trainer/trainer_test.py::TestTrainerDPO::test_trainer 40ms
tests/trainer/trainer_test.py::TestTrainerSFT::test_trainer 36ms
tests/trainer/trainer_test.py::TestTrainerToolsSFT::test_trainer_tools 36ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_0_fsdp::test_fully_async_mode 87ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_1_fsdp::test_fully_async_mode 84ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_2_megatron::test_fully_async_mode 171ms
tests/trainer/trainer_test.py::TestTrainerCheckpointSave_0_fsdp::test_trainer 103ms
tests/trainer/trainer_test.py::TestTrainerCheckpointSave_1_megatron::test_trainer 347ms
tests/trainer/trainer_test.py::TestTrainerMIX::test_trainer 58ms
tests/trainer/trainer_test.py::TestMultiModalGRPO::test_trainer ⏭️ 1ms
tests/trainer/trainer_test.py::TestMultiModalSFT::test_trainer ⏭️ 1ms
tests/trainer/trainer_test.py::TestTrainerLoRA::test_trainer 145ms

Github Test Reporter by CTRF 💚

@hiyuchang
Copy link
Collaborator Author

/unittest-module-trainer

1 similar comment
@pan-x-c
Copy link
Collaborator

pan-x-c commented Oct 13, 2025

/unittest-module-trainer

@github-actions
Copy link

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
20 18 0 2 0 0 2.0s

Skipped

Tests Status
tests/trainer/trainer_test.py::TestMultiModalGRPO::test_trainer skipped ⏭️
tests/trainer/trainer_test.py::TestMultiModalSFT::test_trainer skipped ⏭️

Tests

Test Name Status Flaky Duration
tests/trainer/trainer_test.py::TestTrainerCountdown_0_fsdp::test_trainer 148ms
tests/trainer/trainer_test.py::TestTrainerCountdown_1_megatron::test_trainer 322ms
tests/trainer/trainer_test.py::TestStepAheadAsyncRL::test_trainer 68ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_0_fsdp::test_trainer 52ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_1_fsdp2::test_trainer 53ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_2_fsdp::test_trainer 55ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_3_fsdp2::test_trainer 62ms
tests/trainer/trainer_test.py::TestTrainerSFTWarmupGSM8K::test_trainer 99ms
tests/trainer/trainer_test.py::TestTrainerDPO::test_trainer 39ms
tests/trainer/trainer_test.py::TestTrainerSFT::test_trainer 36ms
tests/trainer/trainer_test.py::TestTrainerToolsSFT::test_trainer_tools 36ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_0_fsdp::test_fully_async_mode 81ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_1_fsdp::test_fully_async_mode 82ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_2_megatron::test_fully_async_mode 174ms
tests/trainer/trainer_test.py::TestTrainerCheckpointSave_0_fsdp::test_trainer 107ms
tests/trainer/trainer_test.py::TestTrainerCheckpointSave_1_megatron::test_trainer 355ms
tests/trainer/trainer_test.py::TestTrainerMIX::test_trainer 58ms
tests/trainer/trainer_test.py::TestMultiModalGRPO::test_trainer ⏭️ 1ms
tests/trainer/trainer_test.py::TestMultiModalSFT::test_trainer ⏭️ 1ms
tests/trainer/trainer_test.py::TestTrainerLoRA::test_trainer 167ms

Github Test Reporter by CTRF 💚

@pan-x-c pan-x-c merged commit d5af956 into agentscope-ai:main Oct 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments