LibrePhotos / librephotos

A self-hosted open source photo management service. This is the repository of the backend.
MIT License
7.01k stars 309 forks source link

Download resnet models when building a docker image #40

Closed derneuere closed 3 years ago

derneuere commented 3 years ago

At startup the backend of librephotos downloads a pytorch model. This model is 250MB big and is download at start every time. This of course is inefficient, because it is a dependency that doesn't change. It should be integrated in the docker steps and the windersnet.py should be rewritten to not download the models but load them from the model integrated from the docker steps.

https://github.com/LibrePhotos/librephotos/blob/6c5796b818b4d1373f20d81d1e2cba641cd70624/wideresnet.py#L9-L15

robertcontois commented 3 years ago

I can see the model in the image once the container has booted up but I don't see when in the boot up process grabbed. Do you happen to know when it occurs exactly? If not I can try working through the startup process.

derneuere commented 3 years ago

I also don't why it is loaded at bootup. AFAIK it is only used here : https://github.com/LibrePhotos/librephotos/blob/dev/api/places365/places365.py

It should be downloaded when it starts scanning, but that does not seem to be the case.