[BUG] docker/volume/immich_model-cache is 65GB
The bug
The docker volume is for the model-cache is excessively large (65GB). My library is single user, 48084 photos, 2753 videos, 393 GB.
50G docker/volumes/immich_model-cache/_data/clip/ViT-g-14__laion2b-s12b-b42k 11G docker/volumes/immich_model-cache/_data/clip/ViT-L-14-336__openai 578M docker/volumes/immich_model-cache/_data/clip/ViT-B-32__openai
Current clip model in settings: immich-app/ViT-g-14__laion2b-s12b-b42k
The OS that Immich Server is running on
Unraid 6.12.10
Version of Immich Server
v1.102.3
Version of Immich Mobile App
v1.102.2 build 135
Platform with the issue
- [X] Server
- [ ] Web
- [ ] Mobile
Your docker-compose.yml content
name: immich
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
command: ['start.sh', 'immich']
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
ports:
- 2283:3001
depends_on:
- redis
- database
restart: always
immich-microservices:
container_name: immich_microservices
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
command: ['start.sh', 'microservices']
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
depends_on:
- redis
- database
restart: always
devices: # HW TRANSCODING QUICKSYNC
- /dev/dri:/dev/dri # HW TRANSCODING QUICKSYNC
immich-machine-learning:
container_name: immich_machine_learning
# image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-openvino #HW ACCELERATION OPEN-VINO
volumes:
- model-cache:/cache
- /dev/bus/usb:/dev/bus/usb # HW ACCELERATION OPEN-VINO
env_file:
- .env
restart: always
##############
# HW ACCEL
#device_cgroup_rules:
# - "c 189:* rmw"
devices:
- /dev/dri:/dev/dri
##############
deploy:
resources:
limits:
cpus: "8"
redis:
container_name: immich_redis
image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:84882e87b54734154586e5f8abd4dce69fe7311315e2fc6d67c29614c8de2672
restart: always
database:
container_name: immich_postgres
image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
restart: always
volumes:
model-cache:
Your .env content
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables
# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/cache_nvme/images/immich
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release
# Connection secret for postgres. You should change it to a random password
DB_PASSWORD=postgres
# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
DB_DATA_LOCATION=/mnt/user/appdata/immich/postgres
REDIS_HOSTNAME=immich_redis
Reproduction steps
I recently redid all the smart search jobs for a large library (~400GB)
Changed the model a few times and was trying to get HW acceleration going
Let me know if you want any logs uploaded, and which logs.
Would also appreciate recommended steps to delete/shrink the volume without losing all my clip stuff.
Relevant log output
root@manitoba:/var/lib/docker/volumes# du -h -d 0 ./immich*
65G ./immich_model-cache
1.4G ./immich_pgdata
411M ./immich_tsdata
root@manitoba:/var/lib/docker/volumes# du -h -d 2 ./immich_model-cache/_data/clip
4.0K ./immich_model-cache/_data/clip/ViT-g-14__laion2b-s12b-b42k/models--immich-app--ViT-g-14__laion2b-s12b-b42k
0 ./immich_model-cache/_data/clip/ViT-g-14__laion2b-s12b-b42k/.locks
1.4G ./immich_model-cache/_data/clip/ViT-g-14__laion2b-s12b-b42k/textual
3.8G ./immich_model-cache/_data/clip/ViT-g-14__laion2b-s12b-b42k/visual
45G ./immich_model-cache/_data/clip/ViT-g-14__laion2b-s12b-b42k/openvino
50G ./immich_model-cache/_data/clip/ViT-g-14__laion2b-s12b-b42k
578M ./immich_model-cache/_data/clip/ViT-B-32__openai
4.0K ./immich_model-cache/_data/clip/ViT-L-14-336__openai/models--immich-app--ViT-L-14-336__openai
476M ./immich_model-cache/_data/clip/ViT-L-14-336__openai/textual
2.3G ./immich_model-cache/_data/clip/ViT-L-14-336__openai/visual
5.8G ./immich_model-cache/_data/clip/ViT-L-14-336__openai/openvino
11G ./immich_model-cache/_data/clip/ViT-L-14-336__openai
Additional information
Possible similar issue: https://github.com/immich-app/immich/issues/5634
If you're changing the ML model around then it's expected to have a bunch of them cached in the model cache, you can clean up the ones you're not using anymore manually.
@mertalev is the large openvino conversion expected?
45G ./immich_model-cache/_data/clip/ViT-g-14__laion2b-s12b-b42k/openvino
Thanks, I thought I would keep them until I find out if any investigation is required.
In general, we just provide a cache folder for OpenVINO; how it gets used is totally up to them.
If it failed a few times (like from a timeout), then there might be duplicate blobs in there. It could also decide that something's different about its environment and it needs to recompile parts (or all) of the model, storing each variant in the cache.
You can delete the openvino folder and restart the service to see how big a clean set of cache blobs is. If it keeps increasing with each restart then that'd be unexpected.
Thanks
I deleted the unused models I deleted all the .blob files in the used model
Restarted containers and everything is working ok, including smart search.
Hi
If I want to mount the immich_mode-cache folder out of the docker volumes and into an externally mounted directory, what is the best way to do that? Thank you.
You can change the model-cache:/cache line to <insert-host-path-here>:/cache.