Skip to content

Skip training-only weights when downloading models - #9

Merged
AmitMY merged 1 commit into
mainfrom
perf/strip-optimizer-weights
Jul 6, 2026
Merged

AmitMY merged 1 commit into
mainfrom
perf/strip-optimizer-weights

Conversation

@AmitMY

@AmitMY AmitMY commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

snapshot_download pulled every file in each model repo, baking training-only artifacts into the Docker image. For sign/sockeye-signwriting-to-text that's a 388 MB optimizer state — larger than the 195 MB weights it ships alongside, and never touched at inference.

Ignoring optimizer_best.pkl and lr_scheduler_best.pkl cuts that model's snapshot from 584 MB → 196 MB.

Why only this (and not multi-stage / bf16)

  • Multi-stage build: marginal here. The runtime image needs torch + sockeye + both models regardless of stages; build-only cruft is already handled (--no-cache-dir, apt lists cleaned). Nothing large to strip in a second stage.
  • bfloat16: real (~100 MB/model) but risky — sockeye's own param format, spotty/slower CPU bf16 ops, changes numerical output, needs offline conversion + revalidation. Not worth it unless size becomes critical.

Verification

Fresh download with the ignore list: snapshot 584 MB → 196 MB, model loads and translates correctly (AS14c20… → goodbye). Ruff + all 6 tests pass.

🤖 Generated with Claude Code

snapshot_download pulled every file in the repo, baking the ~388MB
optimizer state (larger than the 195MB weights themselves) into the
Docker image. Ignore optimizer_best.pkl and lr_scheduler_best.pkl;
they are never touched at inference.

Cuts the sign/sockeye-signwriting-to-text snapshot from 584MB to 196MB.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AmitMY
AmitMY merged commit a5e162a into main Jul 6, 2026
2 checks passed
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