Skip to content

Commit 996c5cf

Browse files
author
intern_nem_dev_1
committed
Make long-document SDG docs paths portable
1 parent 0b31358 commit 996c5cf

7 files changed

Lines changed: 119 additions & 25 deletions

File tree

src/nemotron/recipes/data/sdg/long-document/README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The same stages, dispatched via `nemo-run`. Add `--run <profile>` (attached) or
9999
```bash
100100
nemotron data sdg long-document seed --batch prep \
101101
-c 01-seed num_docs=50 \
102-
output_dir=/lustre/.../sdg/seeds
102+
output_dir=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/seeds
103103
```
104104

105105
For producer stages and the judge, you have two options for the model endpoint:
@@ -112,9 +112,9 @@ Same flow as standalone, plus `--run <profile>` / `--batch <profile>`. The recip
112112
nemotron data sdg long-document ocr --batch prep \
113113
-c 02-ocr \
114114
vllm_endpoint=http://compute-node-0001:8000/v1 \
115-
seed_path=/lustre/.../seeds/seed_per_page.parquet \
115+
seed_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/seeds/seed_per_page.parquet \
116116
num_records=100 \
117-
artifact_path=/lustre/.../sdg/ocr
117+
artifact_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/ocr
118118
```
119119

120120
#### Option B — let the CLI auto-deploy with `--serve`
@@ -134,15 +134,15 @@ Drop the `vllm_endpoint=…` argument when using `--serve` — it's set automati
134134
# runs the recipe against it, tears the deployment down on exit.
135135
nemotron data sdg long-document ocr --batch prep --serve \
136136
-c 02-ocr \
137-
seed_path=/lustre/.../seeds/seed_per_page.parquet \
137+
seed_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/seeds/seed_per_page.parquet \
138138
num_records=100 \
139-
artifact_path=/lustre/.../sdg/ocr
139+
artifact_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/ocr
140140

141141
# Override the default deployment (e.g. test a different vLLM tuning):
142142
nemotron data sdg long-document single-page-qa --batch prep --serve \
143143
--serve-config qwen3-vl-30b \
144144
-c 06-single-page-qa \
145-
seed_path=/lustre/.../seeds/seed_per_page.parquet \
145+
seed_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/seeds/seed_per_page.parquet \
146146
num_records=10000
147147
```
148148

@@ -170,9 +170,9 @@ nemotron data sdg long-document ocr --batch prep --serve -c 02-ocr ...
170170

171171
The `--serve` *serve* task always lands on a GPU partition (the cluster's `sdg_serve_partition` in `env.toml`, defaulting to `interactive`); the *client* task uses the regular `run_partition` / `batch_partition` of the env profile.
172172

173-
### Lustre paths
173+
### Shared output paths
174174

175-
- `seed_path`, `output_dir`, `artifact_path` should all be absolute paths on shared storage (Lustre on dlw). Relative paths resolve to the slurm job's working directory, which is generally not what you want.
175+
- `seed_path`, `output_dir`, `artifact_path` should all point at durable shared output storage. The examples below use `${NEMO_RUN_DIR:-.}/output/data/sdg/long-document`; set `NEMO_RUN_DIR` to a path visible to the client job and any manually launched model server for your cluster.
176176
- The serve sentinel lives at `${remote_job_dir}/sdg-deploy/<recipe-name>/<timestamp>/endpoint`.
177177

178178
### HF / API tokens
@@ -240,13 +240,13 @@ Slurm + Pyxis (1× H100):
240240
srun --partition=interactive --nodes=1 --ntasks=1 --gres=gpu:1 \
241241
--time=04:00:00 \
242242
--container-image=vllm/vllm-openai:v0.14.1 \
243-
--container-mounts=/lustre:/lustre \
243+
--container-mounts=${NEMO_RUN_DIR:-.}:${NEMO_RUN_DIR:-.} \
244244
bash -c "pip install open-clip-torch albumentations timm && \
245245
vllm serve nvidia/NVIDIA-Nemotron-Parse-v1.1 \
246246
--tensor-parallel-size 1 \
247247
--max-model-len 9000 \
248248
--gpu-memory-utilization 0.85 \
249-
--chat-template /lustre/.../chat_template.jinja \
249+
--chat-template ${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/chat_template.jinja \
250250
--trust-remote-code"
251251
```
252252

@@ -342,31 +342,31 @@ uv run --no-project 09-frontier-judge-sdg.py \
342342
# 1. Seed (CPU partition).
343343
nemotron data sdg long-document seed --batch prep \
344344
-c 01-seed \
345-
output_dir=/lustre/.../sdg/seeds \
345+
output_dir=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/seeds \
346346
num_docs=1000
347347

348348
# 2. OCR — auto-deploys nemotron-parse on a GPU node.
349349
nemotron data sdg long-document ocr --batch prep --serve \
350350
-c 02-ocr \
351-
seed_path=/lustre/.../sdg/seeds/seed_per_page.parquet \
351+
seed_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/seeds/seed_per_page.parquet \
352352
num_records=10000 \
353-
artifact_path=/lustre/.../sdg/ocr
353+
artifact_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/ocr
354354

355355
# 3. Single-page QA — auto-deploys Qwen3-VL-235B on 4× GPUs.
356356
nemotron data sdg long-document single-page-qa --batch prep --serve \
357357
-c 06-single-page-qa \
358-
seed_path=/lustre/.../sdg/seeds/seed_per_page.parquet \
358+
seed_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/seeds/seed_per_page.parquet \
359359
num_records=100000 \
360-
artifact_path=/lustre/.../sdg/single_page_qa
360+
artifact_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/single_page_qa
361361

362362
# 4. Judge.
363363
nemotron data sdg long-document judge --batch prep \
364364
-c 09-judge \
365-
seed_path=/lustre/.../sdg/single_page_qa/.../generated.parquet \
365+
seed_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/single_page_qa/.../generated.parquet \
366366
endpoint=https://generativelanguage.googleapis.com/v1beta \
367367
model_id=gemini-2.5-flash-preview-04-17 \
368368
api_key_env=GEMINI_API_KEY \
369-
artifact_path=/lustre/.../sdg/judged_single_page_qa
369+
artifact_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/judged_single_page_qa
370370
```
371371

372372
## Troubleshooting
@@ -418,16 +418,17 @@ Recommended contents for `./published_dataset`:
418418
### Private path: internal storage plus artifact registration
419419

420420
```bash
421-
mkdir -p /lustre/team/datasets/long-document-understanding-sdg/v1
422-
cp -R ./published_dataset/. /lustre/team/datasets/long-document-understanding-sdg/v1/
421+
export LONG_DOC_PUBLISH_DIR="${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/internal/long-document-understanding-sdg/v1"
422+
mkdir -p "$LONG_DOC_PUBLISH_DIR"
423+
cp -R ./published_dataset/. "$LONG_DOC_PUBLISH_DIR"/
423424
```
424425

425426
If your environment uses Nemotron artifact logging:
426427

427428
```bash
428429
nemotron kit log-artifact data \
429430
--name omni3-long-document-sdg \
430-
--path /lustre/team/datasets/long-document-understanding-sdg/v1
431+
--path "$LONG_DOC_PUBLISH_DIR"
431432
```
432433

433434
Otherwise register manually through your standard W&B flow with `wandb.log_artifact`.

src/nemotron/recipes/data/sdg/long-document/config/02-ocr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# `vllm_endpoint` and `seed_path` are required; supply them on the CLI:
44
# nemotron data sdg long-document ocr --run dlw -c 02-ocr \
55
# vllm_endpoint=http://node:8000/v1 \
6-
# seed_path=/lustre/.../seed_per_page.parquet \
6+
# seed_path=${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/seeds/seed_per_page.parquet \
77
# num_records=100
88

99
vllm_endpoint: null
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
from pathlib import Path
2+
3+
REPO_ROOT = Path(__file__).resolve().parents[3]
4+
LONG_DOCUMENT_DIR = REPO_ROOT / "src/nemotron/recipes/data/sdg/long-document"
5+
README = LONG_DOCUMENT_DIR / "README.md"
6+
OCR_CONFIG = LONG_DOCUMENT_DIR / "config/02-ocr.yaml"
7+
PORTABLE_ROOT = "${NEMO_RUN_DIR:-.}/output/data/sdg/long-document"
8+
9+
10+
def _read(path: Path) -> str:
11+
return path.read_text(encoding="utf-8")
12+
13+
14+
def test_long_document_docs_do_not_use_developer_lustre_paths() -> None:
15+
for path in (README, OCR_CONFIG):
16+
text = _read(path)
17+
assert "/lustre/" not in text, f"{path} still contains a concrete /lustre/ example"
18+
19+
20+
def test_long_document_docs_use_portable_output_examples() -> None:
21+
readme_text = _read(README)
22+
ocr_config_text = _read(OCR_CONFIG)
23+
24+
for suffix in (
25+
"seeds",
26+
"seeds/seed_per_page.parquet",
27+
"ocr",
28+
"single_page_qa",
29+
"judged_single_page_qa",
30+
"chat_template.jinja",
31+
"internal/long-document-understanding-sdg/v1",
32+
):
33+
assert f"{PORTABLE_ROOT}/{suffix}" in readme_text
34+
35+
assert f"{PORTABLE_ROOT}/seeds/seed_per_page.parquet" in ocr_config_text
36+
37+
38+
def test_long_document_docs_preserve_cli_commands_and_options() -> None:
39+
readme_text = _read(README)
40+
ocr_config_text = _read(OCR_CONFIG)
41+
42+
for snippet in (
43+
"nemotron data sdg long-document seed",
44+
"nemotron data sdg long-document ocr",
45+
"nemotron data sdg long-document single-page-qa",
46+
"nemotron data sdg long-document judge",
47+
"--batch prep",
48+
"--serve",
49+
"--serve-config",
50+
"--config config/02-ocr.yaml",
51+
"vllm_endpoint=",
52+
"seed_path=",
53+
"artifact_path=",
54+
"output_dir=",
55+
):
56+
assert snippet in readme_text
57+
58+
for snippet in (
59+
"nemotron data sdg long-document ocr --run dlw -c 02-ocr",
60+
"vllm_endpoint=http://node:8000/v1",
61+
"seed_path=",
62+
"num_records=100",
63+
):
64+
assert snippet in ocr_config_text
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# intern_nem_dev_1 - 状态
22

3-
<!-- METADATA:STATUS=Working,TASK=task154_super3_rl_data_prep_doc_output_portability_s1,ROLE=independent,SESSION=1 -->
3+
<!-- METADATA:STATUS=Working,TASK=task157_data_sdg_long_document_docs_path_portability_s1,ROLE=dev,SESSION=1 -->
44

55
| 字段 ||
66
|------|-----|
77
| Name | intern_nem_dev_1 |
88
| Status | Working |
9-
| Current Task | task154_super3_rl_data_prep_doc_output_portability_s1 |
10-
| PR | https://github.com/songCNMS/Nemotron/pull/261 |
9+
| Current Task | task157_data_sdg_long_document_docs_path_portability_s1 |
10+
| PR | pending |
1111
| Session | 1 |
12-
| Recent Progress | Opened PR #261 for task154; Super3 RL data-prep doc M0 output example now uses NEMO_RUN_DIR-relative path and focused docs checks passed |
12+
| Recent Progress | Started task157 from origin/main 0b31358436c38e698c7c2bc3a89871df273df21c; updating long-document SDG docs/comments to use NEMO_RUN_DIR-relative examples |
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# task157_data_sdg_long_document_docs_path_portability_s1
2+
3+
## Scope
4+
5+
- Replace concrete long-document SDG `/lustre/...` documentation examples with `${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/...` examples.
6+
- Keep command names, option names, stage names, and manual/auto-serve semantics unchanged.
7+
- Add focused static coverage for the scoped README and OCR config comment.
8+
9+
## Boundaries
10+
11+
- No production Python, deployment YAML, CLI behavior, generated artifacts, or unrelated docs.
12+
- No live long-document SDG data prep, `--serve` launch, endpoint calls, downloads, training, eval, W&B, cluster jobs, deploy, artifact transfer, main push, or self-merge.
13+
14+
## Status
15+
16+
- Base: `0b31358436c38e698c7c2bc3a89871df273df21c`
17+
- Branch: `intern_nem_dev_1/task157_data_sdg_long_document_docs_path_portability_s1`
18+
- PR: pending
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# History Log
2+
3+
## 2026-05-29
4+
5+
- Started task157 from `origin/main` at `0b31358436c38e698c7c2bc3a89871df273df21c`.
6+
- Updated scoped long-document SDG docs/comments toward `${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/...` portability.
7+
- Added focused static docs test coverage.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Task Knowledge
2+
3+
- Long-document SDG examples should use `${NEMO_RUN_DIR:-.}/output/data/sdg/long-document/...` so docs do not steer users into named-user or cluster-specific storage.
4+
- The task is documentation/comment/static-test only; manual vLLM and `--serve` examples must remain recognizable and keep the same CLI options.

0 commit comments

Comments
 (0)