0

Hugging Face has a caching system to load models from any app.

https://huggingface.co/docs/datasets/cache

This is useful in most cases, but not when building an image in Docker, as the cache must be downloaded everytime.

How can I set the cache files in the Docker app's folder, and build the image properly?

In this way, the cache files won't be downloaded at each build.

NicolasSens
  • 117
  • 1
  • 9

1 Answers1

0

The solution is to copy the cache content from:

Users\<UserName>\.cache\huggingface\transformers

to a local folder, let's say "cache"

Then in the Dockerfile, you have to set the new folder cache in the env variables:

ENV TRANSFORMERS_CACHE=./cache/

And build the image.

NicolasSens
  • 117
  • 1
  • 9