Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion docs/get-started/rollout-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,21 @@ Launch the rollout viewer:
ng_viewer +jsonl_fpath=results/simple_weather_rollouts.jsonl
```

Then visit <http://127.0.0.1:7860>
The viewer starts on port 7860 and accepts requests only from localhost by default. Visit <http://127.0.0.1:7860> in your browser.

:::{tip}
**Configuring Network Access**

By default, the viewer accepts requests only from localhost (`server_host=127.0.0.1`). To make it accessible on your local network:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we change

To make it accessible on your local network:

to

To make it accessible on beyond your local network or accessible from a different machine:


```bash
# Accept requests from anywhere (e.g., for remote access)
ng_viewer +jsonl_fpath=results/simple_weather_rollouts.jsonl +server_host=0.0.0.0

# Use a custom port
ng_viewer +jsonl_fpath=results/simple_weather_rollouts.jsonl +server_port=8080
```
:::

The viewer shows each rollout with:

Expand Down
15 changes: 14 additions & 1 deletion docs/reference/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,25 @@ Launch a Gradio interface to view and explore dataset rollouts interactively.
* - `jsonl_fpath`
- str
- Filepath to a local JSONL file to view.
* - `server_host`
- str
- Network address where the viewer accepts requests. Defaults to `"127.0.0.1"` (localhost only). Set to `"0.0.0.0"` to accept requests from anywhere.
* - `server_port`
- int
- Port where the viewer accepts requests. Defaults to `7860`. If the specified port is unavailable, Gradio will search for the next available port.
```

**Example**
**Examples**

```bash
# Launch viewer with default settings (accessible from localhost only)
ng_viewer +jsonl_fpath=weather_rollouts.jsonl

# Accept requests from anywhere (e.g., for remote access)
ng_viewer +jsonl_fpath=weather_rollouts.jsonl +server_host=0.0.0.0

# Use a custom port
ng_viewer +jsonl_fpath=weather_rollouts.jsonl +server_port=8080
```

---
Expand Down
17 changes: 16 additions & 1 deletion nemo_gym/dataset_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,26 @@ class JsonlDatasetViewerConfig(BaseNeMoGymCLIConfig):
Examples:

```bash
# Launch viewer with default settings (accessible from localhost only)
ng_viewer +jsonl_fpath=weather_rollouts.jsonl

# Accept requests from anywhere (e.g., for remote access)
ng_viewer +jsonl_fpath=weather_rollouts.jsonl +server_host=0.0.0.0

# Use a custom port
ng_viewer +jsonl_fpath=weather_rollouts.jsonl +server_port=8080
```
"""

jsonl_fpath: str = Field(description="Filepath to a local jsonl file to view.")
server_host: str | None = Field(
default=None,
description='Network address where the viewer accepts requests. Defaults to "127.0.0.1" (localhost only). Set to "0.0.0.0" to accept requests from anywhere.',
)
server_port: int | None = Field(
default=None,
description="Port where the viewer accepts requests. Defaults to 7860. If the specified port is unavailable, Gradio will search for the next available port.",
)


def get_aggregate_metrics(data: List[DatasetViewerVerifyResponse]) -> Dict[str, Any]:
Expand Down Expand Up @@ -281,4 +296,4 @@ def select_item(value: int):
def main(): # pragma: no cover
config = JsonlDatasetViewerConfig.model_validate(get_global_config_dict())
demo = build_jsonl_dataset_viewer(config)
demo.launch(enable_monitoring=False)
demo.launch(server_name=config.server_host, server_port=config.server_port, enable_monitoring=False)