Hi,
we are trying to use a shared cache directory between users. However, when loading a new model from the hub with .from_pretrained the permissions of the created directory is 700, i.e. others can’t read it.
Shouldn’t the permission be the same as the root cache directory?
How can I modify the permissions of cached models, preferrably per ENV variable?
2 Likes
+1 to this. We hit many issues using a shared cache directory, a couple cases:
- User1 creates folder when downloading model/dataset, which doesn’t have group write permissions. User2 cannot use it because they can’t add a
.lock file to the folder.
- User3 attempts to remove User2’s
.lock file, and fails on permission error.
Is there any way to resolve these, without some cron job that updates permissions and prunes .lock files as root?
1 Like
In some minor cases, the issue can be resolved simply by changing the HF_HOME environment variable (HF_CACHE or so also defaults to depend on this environment variable).
export HF_HOME="/somewhere_shared/huggingface" # instead of default "~/.cache/huggingface"
However, in this case, there is .lock and multiple users are involved, which makes it more complicated…
You may need to apply a patch to the file_download function.
1 Like