Skip to content

Ship ag_args as JSON instead of pickle - #263

Merged
shchur merged 3 commits into
masterfrom
ag-args-json
Aug 7, 2026
Merged

Ship ag_args as JSON instead of pickle#263
shchur merged 3 commits into
masterfrom
ag-args-json

Conversation

@shchur

@shchur shchur commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Description

The remote-training config (predictor init/fit args) was serialized with pickle and unpickled inside the SageMaker/Ray container, so a tampered ag_args file would be arbitrary-code execution on load. This switches the on-the-wire format to JSON.

Non-JSON-serializable inputs (search spaces, custom metric objects, classes/callables in hyperparameters) now raise an informative error that names the offending user argument. A future extra cloudpickle channel can carry such objects opt-in.

Changes

  • backend.dumps_ag_args(): serialize-or-raise helper, used by prepare_args
  • Flip the three read sites to json.load; rename ag_args.pklag_args.json
  • Add unit tests for the serialization error paths

shchur added 3 commits August 7, 2026 09:41
The remote-training config (predictor init/fit args) was serialized with
pickle and unpickled inside the SageMaker/Ray container, so a tampered
ag_args file would be arbitrary-code execution on load. Switch to JSON.

Non-JSON-serializable inputs (search spaces, custom metric objects,
classes/callables in hyperparameters) now raise an informative error that
names the offending user argument. A future 'extra' cloudpickle channel can
carry such objects opt-in.

- backend.dumps_ag_args(): serialize-or-raise helper, used by prepare_args
- flip the three read sites to json.load; rename ag_args.pkl -> ag_args.json
- add unit tests for the serialization error paths
- dumps_ag_args: reuse the original TypeError on the fallback path instead
  of re-serializing the config just to re-raise.
- Raise an informative error when image_column is passed for a tabular
  predictor; tabular image support requires autogluon.multimodal, which is
  being deprecated. MultiModal predictors (string image_column) are unaffected.
test_tabular_tabular_text_image trained a tabular predictor with an image
column (AG_IMAGE_NN/AG_TEXT_NN + a live FeatureMetadata object) — a workflow
that requires autogluon.multimodal and no longer works over JSON ag_args.
Drop it along with the now-deprecated image_column docstring entry.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Job PR-263-cf99774 is done.
Docs are uploaded to https://d12sc05jpx1wj5.cloudfront.net/PR-263/cf99774/index.html

@shchur
shchur merged commit 2bfae83 into master Aug 7, 2026
12 checks passed
@shchur
shchur deleted the ag-args-json branch August 7, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant