You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(sdk): unify behavior between cli and sdk to auto save results (#272)
<!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION
& AFFILIATES. All rights reserved. -->
<!-- SPDX-License-Identifier: Apache-2.0 -->
<!-- Thank you for contributing to Safe Synthesizer! -->
# Summary
<!-- Brief description of changes -->
This PR fixes row 20 from the [bug bash
feedback](https://docs.google.com/spreadsheets/d/1fmFYl89hUCNMROR3B_hnq4oqaqM8tAQJJc7p2P17ep4/edit?gid=0#gid=0).
Previously, cli calls `.save_results()` automatically, while for sdk
`.save_results()` need to be explicitly called. With this change, we
call `.save_results()` in `.run()`, which applies to both cli and sdk.
## Pre-Review Checklist
<!-- These checks should be completed before a PR is reviewed, -->
<!-- but you can submit a draft early to indicate that the issue is
being worked on. -->
Ensure that the following pass:
- [x] `make format && make check` or via prek validation.
- [x] `make test` passes locally
- [x] `make test-e2e` passes locally
- [ ] `make test-ci-container` passes locally (recommended)
- [ ] GPU CI status check passes -- comment `/sync` on this PR to
trigger a run (auto-triggers on ready-for-review)
## Pre-Merge Checklist
<!-- These checks need to be completed before a PR is merged, -->
<!-- but as PRs often change significantly during review, -->
<!-- it's OK for them to be incomplete when review is first requested.
-->
- [x] New or updated tests for any fix or new behavior
- [x] Updated documentation for new features and behaviors, including
docstrings for API docs.
## Testing
- CLI
- default output path: `safe-synthesizer run --config
/root/configs/quick-tinyllama-unsloth.yaml --data-source
/root/datasets/clinc_oos.csv`. Everything's there:
<img width="298" height="295" alt="image"
src="https://github.com/user-attachments/assets/b02547b1-a98b-4cff-b2be-dc7ced8bda66"
/>
- output file override: `safe-synthesizer run --config
/root/configs/quick-tinyllama-unsloth.yaml --data-source
/root/datasets/clinc_oos.csv --output-file
/root/Safe-Synthesizer/safe-synthesizer-artifacts/output-path-override/synth.csv`:
everything else is still in the default path, except for the generated
csv
<img width="300" height="402" alt="image"
src="https://github.com/user-attachments/assets/1a710b64-dab0-4592-9c4d-1e96eed2a85d"
/>
- SDK
- ran the 101 notebook:
```
from nemo_safe_synthesizer.sdk.library_builder import SafeSynthesizer
builder = SafeSynthesizer().with_data_source(df).with_replace_pii(enable=False).with_train(num_input_records_to_sample=1000).resolve()
builder.run()
results = builder.results
```
everything's there
<img width="293" height="331" alt="image"
src="https://github.com/user-attachments/assets/6b1b1b4b-a00a-4366-9282-da6ad2e0230e"
/>
---------
Signed-off-by: nina-xu <19981858+nina-xu@users.noreply.github.com>
0 commit comments