optuna.artifacts.upload_artifact(study_or_trial, file_path, artifact_store, *, storage=None, mimetype=None, encoding=None)[source]

Upload an artifact to the artifact store.

  • study_or_trial (Trial | FrozenTrial | Study) – A Trial object, a FrozenTrial, or a Study object.

  • file_path (str) – A path to the file to be uploaded.

  • artifact_store (ArtifactStore) – An artifact store.

  • storage (BaseStorage | None) – A storage object. If trial is not a Trial object, this argument is required.

  • mimetype (str | None) – A MIME type of the artifact. If not specified, the MIME type is guessed from the file extension.

  • encoding (str | None) – An encoding of the artifact, which is suitable for use as a Content-Encoding header (e.g. gzip). If not specified, the encoding is guessed from the file extension.


An artifact ID.

Return type:



Added in v3.3.0 as an experimental feature. The interface may change in newer versions without prior notice. See https://github.com/optuna/optuna/releases/tag/v3.3.0.