File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,20 @@ if [ -z "${MODEL_IMPL_TYPE:-}" ]; then
3636 MODEL_IMPL_TYPE=flax_nnx
3737fi
3838
39+ # Try to cache HF models
40+ persist_cache_dir=" /mnt/disks/persist/models"
41+ home_cache_dir=" $HOME /models"
42+
43+ if ( mkdir -p " $persist_cache_dir " ); then
44+ LOCAL_HF_HOME=" $persist_cache_dir "
45+ elif ( mkdir -p " $home_cache_dir " ); then
46+ LOCAL_HF_HOME=" $home_cache_dir "
47+ else
48+ echo " Error: Failed to create either $persist_cache_dir or $home_cache_dir "
49+ exit 1
50+ fi
51+ DOCKER_HF_HOME=" /tmp/hf_home"
52+
3953# Prune older images on the host to save space.
4054docker system prune -a -f --filter " until=3h"
4155
@@ -48,6 +62,8 @@ exec docker run \
4862 --net host \
4963 --shm-size=16G \
5064 --rm \
65+ -v " $LOCAL_HF_HOME " :" $DOCKER_HF_HOME " \
66+ -e HF_HOME=" $DOCKER_HF_HOME " \
5167 -e TPU_BACKEND_TYPE=" $TPU_BACKEND_TYPE " \
5268 -e MODEL_IMPL_TYPE=" $MODEL_IMPL_TYPE " \
5369 -e HF_TOKEN=" $HF_TOKEN " \
You can’t perform that action at this time.
0 commit comments