Skip to content

Keep the served file extension in TrainedModel.download() - #582

Open
mkaic wants to merge 2 commits into
mainfrom
kai/nas-child-onnx-filename
Open

mkaic wants to merge 2 commits into
mainfrom
kai/nas-child-onnx-filename

Conversation

@mkaic

@mkaic mkaic commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Note

Code and PR description are LLM-written. If this PR has been marked Ready For Review, code has
been reviewed and tested in staging by Kai

Diff breakdown

Category Approximate changed lines
Genuinely new or altered logic 6
Moving or rearranging existing logic 0
Tests 31
Documentation 11
Generated file / lockfile churn 0

Description

TrainedModel.download() always saved the downloaded file as weights.pt. The API serves some models in a different format, for example model.safetensors or weights.onnx. For those models, the file on disk had the wrong extension.

Now the method reads the extension from the signed URL that the API returns. The file name is weights plus that extension. If the URL has no extension, the method uses .pt.

A model that the API serves as a .pt file still saves as weights.pt. This includes best.pt for classification models. The format argument does not change and accepts only "pt".

Testing

Pending.

🤖 Generated with Claude Code

mkaic and others added 2 commits November 11, 2026 13:21
The method saved every download as weights.pt, also when the API served
an ONNX or safetensors artifact.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mkaic
mkaic marked this pull request as ready for review November 11, 2026 22:06

This branch has not been deployed

No deployments
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