-
Notifications
You must be signed in to change notification settings - Fork 294
feat: unify nemogym dataset #1807
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
Merged
+178
−127
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6ec3b95
support nemor gym config
RayenTian 31f2703
support run nemo-gym grpo
RayenTian 32a63e3
unify nemo gym interaface
RayenTian 7a2f009
update nemogym config
RayenTian 2a08dd2
update config
yuki-97 d9fd70d
update nemogym dataset and data processor
yuki-97 98b6744
fix Dataset issue
yuki-97 e52569f
use setup_response_data
yuki-97 b181c78
fix unit test and minor update
yuki-97 e0c20e1
pyrefly
yuki-97 a28d13b
coderabbit
yuki-97 0e03bff
address comments
yuki-97 66cb82c
add comment
yuki-97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
nemo_rl/data/datasets/response_datasets/nemogym_dataset.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | ||
yuki-97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # | ||
| # 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 datasets import Dataset | ||
|
|
||
| from nemo_rl.data.datasets.raw_dataset import RawDataset | ||
|
|
||
|
|
||
| class NemoGymDataset(RawDataset): | ||
| """Simple wrapper around the Nemo Gym dataset. | ||
|
|
||
| Args: | ||
| data_path: Path to the dataset JSONL file | ||
| repeat: Number of times to repeat the dataset, default is 1 | ||
| """ | ||
|
|
||
| def __init__(self, data_path: str, repeat: int = 1, **kwargs) -> None: | ||
| self.task_name = "-".join(data_path.split("/")[-2:]).split(".")[0] | ||
| if self.task_name[0] == "-": | ||
| self.task_name = self.task_name[1:] | ||
|
|
||
| # load raw line from jsonl | ||
| # will use `json.loads` to load to dict format at `nemo_gym_data_processor` later since `Dataset` cannot handle nested structure well | ||
| with open(data_path) as f: | ||
| self.dataset = [raw_line for raw_line in f] | ||
yuki-97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # format the dataset | ||
| self.dataset = Dataset.from_dict( | ||
| { | ||
| "extra_env_info": self.dataset, | ||
| "task_name": [self.task_name] * len(self.dataset), | ||
| } | ||
| ) | ||
|
|
||
| # repeat the dataset | ||
| if repeat > 1: | ||
| self.dataset = self.dataset.repeat(repeat) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.