Repository navigation
Make baked GPT-2 weights readable by the Lambda user - #7
Merged
Merged
Conversation
safetensors 0.8 saves model.safetensors via a tempfile+rename, leaving it mode 0600 owned by root. Lambda runs as a non-root user, so opening it failed (reported by safetensors as "No such file or directory"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gpt2_inferfailed on AWS with:The file was in the image. safetensors 0.8 saves via a tempfile + rename (
safetensors/src/tensor.rs), which leavesmodel.safetensorsas mode0600, owned by root. Lambda runs as a non-root user, soopen()fails, and safetensors reports every open failure as "No such file or directory" (bindings/python/src/lib.rs). Tokenizer/config files are written normally, which is why only the weights failed.Fix
chmod -R a+rX "${GPT2_MODEL_DIR}"after the download in theDockerfile.Testing
POST /evaluatewith"model": "gpt2_infer"returned 200 in ~0.5–0.7s with generated text; the sameseedgave identical output.Not in this PR
The first request after a cold start returns 503 at 30s (API Gateway timeout) while torch and GPT-2 load. That will be handled separately.
🤖 Generated with Claude Code