How to share downloaded huggingface models among users?

98 views Asked by At

I'd like several users to share downloaded models, such that when any of the users downloads a model, e.g. using

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

the other users would be able to use it as well for inference, without having to download it again. The users would all be using linux, but may use different hosts, have different python environments and package versions, etc.

I'd like to know if the following solution will work: Creating a shared NFS mount, e.g. /models and mount it on all hosts. Then, for each user, symlink their HF cache hub dir to a shared path. E.g. ln -s /models ~/.cache/huggingface/hub.

I don't want to symlink ~/.cache/huggingface/, since it also contains a personal HF token, and custom code in modules.

Assuming we can configure file permissions properly, will this work as expected or could there still be issues? E.g.:

  • conflicts between different versions of packages, virtualenv/conda envs etc. between users
  • file locking issues
0

There are 0 answers