-
Notifications
You must be signed in to change notification settings - Fork 18
fix: move nss jobs into plugin, update docs #195
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
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2baf8e4
fix: move nss jobs into plugin, update docs
mckornfield 4ebd512
chore: address feedback
mckornfield 1bda39a
address cr
mckornfield 24faf94
chore: lint fixes
mckornfield 19fa74d
fix: inference key setting
mckornfield b27c305
Merge branch 'main' into nss-docs/mck
mckornfield 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| !!! note | ||
| The platform pre-configures a `system/nvidia-build` model provider during startup. | ||
| `nemo setup` pre-configures a `default/nvidia-build` model provider during local startup. | ||
| This provider routes inference requests to models hosted on `build.nvidia.com` using the API base URL `https://integrate.api.nvidia.com` | ||
| and the NGC API key with `Public API Endpoints` permissions provided during deployment (automatically saved as the built-in `system/ngc-api-key` secret). | ||
| and the NGC API key with `Public API Endpoints` permissions provided during deployment. | ||
|
|
||
| You can verify this provider exists by running `nemo inference providers list --workspace system`. | ||
| You can verify this provider exists by running `nemo inference providers list --workspace default`. | ||
|
|
||
| The tutorials in these docs use this provider for inference, but you can alternatively create your own and use it instead. |
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 @@ | ||
| tutorials/evaluation_report.html |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| <a id="safe-synthesizer-nmp-sdk-resources"></a> | ||
| # Safe Synthesizer {{platform_name}} SDK Resources | ||
|
|
||
| The `nemo_safe_synthesizer_plugin.sdk` module provides {{platform_name}}-specific helpers for creating and monitoring {{nss_short_name}} jobs. Use these objects when you want to submit jobs through the platform Jobs service and retrieve platform-managed results. | ||
|
|
||
| ## SafeSynthesizerResource | ||
|
|
||
| `SafeSynthesizerResource` is the entry point mounted on a `NeMoPlatform` client: | ||
|
|
||
| ```python | ||
| import os | ||
|
|
||
| from nemo_platform import NeMoPlatform | ||
|
|
||
| client = NeMoPlatform( | ||
| base_url=os.environ.get("NMP_BASE_URL", "http://localhost:8080"), | ||
| workspace="default", | ||
| ) | ||
| safe_synthesizer = client.safe_synthesizer | ||
| ``` | ||
|
|
||
| An async variant with the same namespace is available as `AsyncNeMoPlatform.safe_synthesizer`. | ||
|
|
||
| ## SafeSynthesizerJobsResource | ||
|
|
||
| `client.safe_synthesizer.jobs` calls the plugin API for {{nss_short_name}} jobs. | ||
|
|
||
| | Method | Description | | ||
| |--------|-------------| | ||
| | `create(*, spec, name=None, workspace=None, project=None, timeout=None, **params)` | Creates a {{nss_short_name}} platform job from a job spec. | | ||
| | `list(*, workspace=None, **params)` | Lists {{nss_short_name}} jobs in a workspace. | | ||
| | `retrieve(name, *, workspace=None)` | Retrieves one {{nss_short_name}} job by name. | | ||
| | `get_status(name, *, workspace=None)` | Returns the job status from the platform Jobs service. | | ||
| | `get_logs(name, *, workspace=None, **kwargs)` | Returns paginated job logs from the platform Jobs service. | | ||
|
|
||
| The async resource exposes the same methods as `async def` methods. | ||
|
|
||
| ## SafeSynthesizerJobBuilder | ||
|
|
||
| `SafeSynthesizerJobBuilder` assembles a job spec, uploads local datasets to Files, submits the job, and returns a `SafeSynthesizerJob` wrapper. | ||
|
|
||
| ```python | ||
| import pandas as pd | ||
|
|
||
| from nemo_safe_synthesizer_plugin.sdk.job_builder import SafeSynthesizerJobBuilder | ||
|
|
||
| df = pd.DataFrame({"text": ["sample record"]}) | ||
|
|
||
| job = ( | ||
| SafeSynthesizerJobBuilder(client, workspace="default") | ||
| .with_data_source(df) | ||
| .with_classify_model_provider("default/nvidia-build") | ||
| .with_replace_pii() | ||
| .synthesize() | ||
| .create_job(name="safe-synth-job", project="default-project") | ||
| ) | ||
| ``` | ||
|
|
||
| | Method | Description | | ||
| |--------|-------------| | ||
| | `with_data_source(data_source)` | Sets a pandas DataFrame or local `.csv`, `.parquet`, `.json`, or `.jsonl` file as input. Local data is uploaded to Files before submission. | | ||
| | `with_data(config=None, **kwargs)` | Sets data preparation parameters. | | ||
| | `with_train(config=None, **kwargs)` | Sets fine-tuning parameters. | | ||
| | `with_generate(config=None, **kwargs)` | Sets generation parameters and enables synthesis. | | ||
| | `synthesize()` | Enables synthesis. | | ||
| | `with_evaluate(config=None, **kwargs)` | Sets evaluation parameters. | | ||
| | `with_differential_privacy(config=None, **kwargs)` | Sets DP-SGD parameters. | | ||
| | `with_time_series(config=None, **kwargs)` | Sets time-series parameters. | | ||
| | `with_replace_pii(config=None, **kwargs)` | Enables PII replacement. | | ||
| | `with_classify_model_provider(provider_name)` | Sets the Inference Gateway provider used for PII column classification. Pair with `with_replace_pii()`. | | ||
| | `with_hf_token_secret(secret_name)` | Passes a platform secret name as `HF_TOKEN` to the runtime job. | | ||
| | `with_pretrained_model_job(job_name)` | Reuses a prior job's `adapter` result for generation-only synthesis. | | ||
| | `resolve_job_config()` | Uploads data and validates the generated job spec without submitting. | | ||
| | `create_job(**kwargs)` | Submits the job and returns `SafeSynthesizerJob`. | | ||
|
|
||
| ## SafeSynthesizerJob | ||
|
|
||
| `SafeSynthesizerJob` is a convenience wrapper returned by the builder. | ||
|
|
||
| | Method | Description | | ||
| |--------|-------------| | ||
| | `fetch_status()` | Returns the current platform job status string. | | ||
| | `fetch_status_info()` | Returns the full platform job status response. | | ||
| | `wait_for_completion(poll_interval=10, verbose=True, log_timeout=None)` | Polls status and logs until the job reaches a terminal state. Raises `RuntimeError` for `error` or `cancelled`. | | ||
| | `fetch_logs(timeout=None)` | Iterates over platform job log entries. | | ||
| | `print_logs(timeout=None)` | Prints platform job logs to stdout. | | ||
| | `fetch_data()` | Downloads the `synthetic-data` result and returns it as a pandas DataFrame. | | ||
| | `fetch_summary()` | Downloads the `summary` result as a `SafeSynthesizerSummary`. | | ||
| | `fetch_report()` | Downloads the `evaluation-report` result as HTML. | | ||
| | `save_report(path)` | Saves the HTML evaluation report to a local file. | | ||
| | `display_report_in_notebook(width="100%", height=1000)` | Displays the evaluation report in a notebook. | | ||
|
|
||
| ## Related Topics | ||
|
|
||
| - [Safe Synthesizer 101](tutorials/safe-synthesizer-101.md) - submit and monitor a first job | ||
| - [Safe Synthesizer Jobs](about/jobs.md) - understand job lifecycle and troubleshooting | ||
| - [Parameters Reference](about/reference.md) - review job spec and configuration fields |
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.