fix(dataset): apply --synthesis-max-osl cap in loader overrides#1122
fix(dataset): apply --synthesis-max-osl cap in loader overrides#1122ajcasagrande wants to merge 1 commit into
Conversation
… synthesizer payload guard Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Anthony Casagrande <acasagrande@nvidia.com>
Try out this PRQuick install: pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@760ee619314c72131f540c8040fc60c2b5bc5555Recommended with virtual environment (using uv): uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@760ee619314c72131f540c8040fc60c2b5bc5555Last updated for commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (6)
WalkthroughThis PR reorders max output-length capping relative to filtering summary logging in the BurstGPT and SageMaker dataset loaders, adds event-attributed error handling for SageMaker payload decoding, and gates Synthesizer's input_length assignment on payload absence. Unit tests cover these behaviors. ChangesDataset loader capping, decoding, and synthesis behavior
Estimated code review effort: 3 (Moderate) | ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The bug:
--synthesis-max-oslsilently doesn't cap for loaders that overrideload_datasetThe base-loader refactor moved the max-OSL cap out of
_filter_and_cap_traceinto a grouped pass (_cap_grouped_traces_max_osl) run byBaseTraceDatasetLoader.load_dataset(src/aiperf/dataset/loader/base_trace_loader.py:256), applied after synthesis. Two loaders overrideload_datasetand never call it, so--synthesis-max-oslreturned uncapped output lengths with no warning:src/aiperf/dataset/loader/burst_gpt.py): CSV override now calls_cap_grouped_traces_max_osl(data)after synthesis and logs the filtering summary after the cap, so the capped count shows up in the summary (matching the base order).src/aiperf/dataset/loader/sagemaker_data_capture.py): same fix, same ordering. Also hardens_decode_payloadto re-raise malformed base64 / inner-JSON payloads asDatasetLoaderErrorwith per-recordeventIdattribution instead of leaking rawbinascii.Error/JSONDecodeErrorthat aborts the whole load without saying which record was bad.Synthesizer payload guard
Synthesizer.synthesize_traces(src/aiperf/dataset/synthesis/synthesizer.py) injectedinput_lengthinto any trace lackingtext_input/messages— including traces that use a pre-builtpayload.MooncakeTracerequires exactly one ofinput_length/text_input/messages/payload, so synthesis over payload traces produced datasets that fail validation. The guard now also skips traces withpayload.Tests (all pinned via revert-verification)
Each src change was reverted with
git apply -R, its tests confirmed FAILING, then re-applied and confirmed green:TestMaxOslCapApplied::test_output_length_capped_after_load,test_parse_trace_invalid_base64_input_raises_dataset_loader_error,test_parse_trace_invalid_inner_json_raises_dataset_loader_error)TestMaxOslCapApplied::test_output_length_capped_after_load)TestSynthesizer::test_payload_trace_not_given_input_length, new test written for this PR — the fix previously shipped test-less)Evidence
uv run pytest -n auto tests/unit/dataset/loader/test_sagemaker_data_capture.py tests/unit/dataset/loader/test_burst_gpt_trace.py tests/unit/dataset/synthesis/test_synthesizer.py→ 120 passedpytest --collect-onlyclean (120 collected)ruff format --check/ruff checkclean on all touched filesmake check-ruff-baselined→ OK (118 total, 118 baselined, 0 new)🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests