model.safetensors is missing read permissions after saving with SentenceTransformer.save()
Author: BestCrazyNoobCreated Sep 12, 2026Updated Sep 12, 2026
When using SentenceTransformer.save(), model.safetensors has different read permissions from all other files in the model directory:
- other files have
-rw-rw-r--, which is the standard value for most files model.safetensorshas-rw-------
This is a small detail but can cause a bit of annoyance in particular use cases, for example:
- One wants to include a model in a Docker image
- He downloads and saves it when building the image. The saved files are by default owned by root.
- The folder in which the model was saved looks readable (it has
-rw-rw-r--) - When one runs the container (which he is presumably not doing as root) and tries to load the model he gets a
FileNotFoundError: No such file or directory: model.safetensors
Would it be possible to fix this?
Environment:
sentence-transformers6.0.1transformers4.57.6- Python 3.12.14
Source: huggingface/sentence-transformers