Skip to content

Commit 86dde55

Browse files
committed
Merge remote-tracking branch 'github/main' into fsiino/resource-server-organization
Signed-off-by: Frankie Siino <fsiino@nvidia.com> # Conflicts: # resources_servers/comp_coding/configs/comp_coding.yaml
2 parents 08ef6d9 + 8e41fc2 commit 86dde55

35 files changed

+2098
-390
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,14 +600,15 @@ ng_collect_rollouts +agent_name=multineedle_simple_agent \
600600
+output_jsonl_fpath=results/multineedle_rollout_collection.jsonl \
601601
+limit=null \
602602
+num_repeats=null \
603-
+num_samples_in_parallel=null
603+
+num_samples_in_parallel=null \
604+
+responses_create_params.max_output_tokens=32_768
604605
```
605606

606607
The supported parameters include:
607608
- `limit`: Limits how many examples from the input JSONL file to process
608609
- `num_repeats`: Repeats each input example multiple times to collect multiple rollouts per example
609610
- `num_samples_in_parallel`: Controls how many rollout collection requests run concurrently
610-
611+
- `responses_create_params`: A dictionary of sampling parameter overrides.
611612

612613
View the rollouts just collected!
613614
```
@@ -637,6 +638,7 @@ multineedle_simple_agent:
637638
type: train
638639
license: Apache 2.0
639640
jsonl_fpath: resources_servers/multineedle/data/train.jsonl
641+
num_repeats: 1
640642
gitlab_identifier:
641643
dataset_name: multineedle
642644
version: 0.0.1
@@ -646,6 +648,7 @@ multineedle_simple_agent:
646648
type: validation
647649
license: Apache 2.0
648650
jsonl_fpath: resources_servers/multineedle/data/validation.jsonl
651+
num_repeats: 1
649652
gitlab_identifier:
650653
dataset_name: multineedle
651654
version: 0.0.1
@@ -654,12 +657,14 @@ multineedle_simple_agent:
654657
- name: example
655658
type: example
656659
jsonl_fpath: resources_servers/multineedle/data/example.jsonl
660+
num_repeats: 1
657661
```
658662

659663
A dataset object consists of:
660664
- Name: An identifier for you
661665
- Type: train, validation, or example. Train and validation are as used in NeMo RL or other train frameworks. More information about the example type is in the next section.
662666
- Jsonl fpath: the local file path to your jsonl file for this dataset.
667+
- Num repeats: optionally repeat each row when preparing or collating data. Defaults to 1 if unspecified.
663668
- Gitlab identifier: The remote path to the dataset as held in the Gitlab dataset registry. This field is required for train and validation datasets. (Not required for example datasets since those are required to be committed to Git).
664669
- License: The license of that dataset. Required for train and validation datasets and not required for example datasets, similar in principle to the Gitlab identifier.
665670
- Start idx, end idx: used for slicing your dataset.
@@ -816,7 +821,7 @@ ng_collect_rollouts +agent_name=library_judge_math_simple_agent \
816821
+input_jsonl_fpath=resources_servers/library_judge_math/data/dapo17k_bytedtsinghua_train.jsonl \
817822
+output_jsonl_fpath=temp/library_judge_math_rollouts.jsonl \
818823
+limit=1024 \
819-
+num_repeats 1
824+
+num_repeats=1
820825
```
821826

822827
After `ng_collect_rollouts` finishes, ctrl+c to quit your servers. You should see some output in the terminal like this:

nemo_gym/cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ def init_resources_server(): # pragma: no cover
518518
- name: train
519519
type: train
520520
jsonl_fpath: resources_servers/{server_type_name}/data/train.jsonl
521+
num_repeats: 1
521522
gitlab_identifier:
522523
dataset_name: {server_type_name}
523524
version: 0.0.1
@@ -526,6 +527,7 @@ def init_resources_server(): # pragma: no cover
526527
- name: validation
527528
type: validation
528529
jsonl_fpath: resources_servers/{server_type_name}/data/validation.jsonl
530+
num_repeats: 1
529531
gitlab_identifier:
530532
dataset_name: {server_type_name}
531533
version: 0.0.1
@@ -534,6 +536,7 @@ def init_resources_server(): # pragma: no cover
534536
- name: example
535537
type: example
536538
jsonl_fpath: resources_servers/{server_type_name}/data/example.jsonl
539+
num_repeats: 1
537540
""")
538541

539542
app_fpath = dirpath / "app.py"

nemo_gym/config_types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ class DatasetConfig(BaseModel):
8787
type: DatasetType
8888
jsonl_fpath: str
8989

90+
num_repeats: int = Field(default=1, ge=1)
9091
gitlab_identifier: Optional[JsonlDatasetGitlabIdentifer] = None
9192
license: Optional[
9293
Union[
9394
Literal["Apache 2.0"],
95+
Literal["MIT"],
9496
Literal["Creative Commons Attribution 4.0 International"],
9597
Literal["Creative Commons Attribution-ShareAlike 4.0 International"],
9698
Literal["TBD"],

nemo_gym/openai_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
from pydantic import BaseModel, ConfigDict, Field
7575
from typing_extensions import TypedDict
7676

77-
from nemo_gym.server_utils import request
77+
from nemo_gym.server_utils import raise_for_status, request
7878

7979

8080
########################################
@@ -432,6 +432,7 @@ async def create_chat_completion(self, **kwargs):
432432
json=kwargs,
433433
headers={"Authorization": f"Bearer {self.api_key}"},
434434
)
435+
raise_for_status(response)
435436
return await response.json()
436437

437438
async def create_response(self, **kwargs):
@@ -441,6 +442,7 @@ async def create_response(self, **kwargs):
441442
json=kwargs,
442443
headers={"Authorization": f"Bearer {self.api_key}"},
443444
)
445+
raise_for_status(response)
444446
return await response.json()
445447

446448
async def create_tokenize(self, **kwargs):
@@ -451,4 +453,5 @@ async def create_tokenize(self, **kwargs):
451453
json=kwargs,
452454
headers={"Authorization": f"Bearer {self.api_key}"},
453455
)
456+
raise_for_status(response)
454457
return await response.json()

nemo_gym/rollout_collection.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
from collections import Counter
1818
from contextlib import nullcontext
1919
from itertools import chain, repeat
20-
from typing import Dict, List, Optional
20+
from typing import Any, Dict, List, Optional
2121

22-
from pydantic import BaseModel
22+
from pydantic import BaseModel, Field
2323
from tqdm.asyncio import tqdm
2424

2525
from nemo_gym.config_types import BaseServerConfig
@@ -39,6 +39,7 @@ class RolloutCollectionConfig(BaseModel):
3939
limit: Optional[int] = None
4040
num_repeats: Optional[int] = None
4141
num_samples_in_parallel: Optional[int] = None
42+
responses_create_params: Dict[str, Any] = Field(default_factory=dict)
4243

4344

4445
class RolloutCollectionHelper(BaseModel): # pragma: no cover
@@ -68,10 +69,14 @@ async def run_from_config(self, config: RolloutCollectionConfig):
6869
f"The tqdm progress bar will only update every {tqdm_miniters} samples that finish to ensure that you are not being spammed."
6970
)
7071

72+
if config.responses_create_params:
73+
print(f"Overriding responses_create_params fields with {config.responses_create_params}")
74+
7175
metrics = Counter()
7276
with open(config.output_jsonl_fpath, "a") as f:
7377

7478
async def _post_coroutine(row: dict) -> None:
79+
row["responses_create_params"] = row["responses_create_params"] | config.responses_create_params
7580
async with semaphore:
7681
response = await server_client.post(server_name=config.agent_name, url_path="/run", json=row)
7782
result = await response.json()

0 commit comments

Comments
 (0)