Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading model from cache in docker container #162

Open
skolachi opened this issue Jul 26, 2024 · 0 comments
Open

Error loading model from cache in docker container #162

skolachi opened this issue Jul 26, 2024 · 0 comments

Comments

@skolachi
Copy link

I am unable to load the model from cache in offline mode.

  1. I set environment variable HF_HOME to /.cache/huggingface/hub in the Dockerfile.
  2. I copied the cached models from my local to HF_HOME in the Dockerfile. GLiNER model requires the mdeberta model so I copied that model as well to HF_HOME.
  3. In the container, I load the model from cache using the following Python code-

from gliner import GLiNER
import is
model = GLiNER.from_pretrained(“urchade/gliner_multi-v2.1”, cache_dir=os.environ[“HF_HOME”], local_files_only=True)

This throws the following error-

requests.exceptions.SSLError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /microsoft/mdeberta-v3-base/resolve/main/tokenizer_config.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))"), '(Request ID: 2deb8e47-d667-42c7-9d03-b7afdac14b88)')

It looks like the code is trying to download mdeberta model again.

I also tried to set cache_dir to other options such as “/.cache/huggingface”, “/.cache/huggingface/hub/models—urchade—gliner_multi-v2.1”, “/.cache/huggingface/hub/models—urchade—gliner_multi-v2.1/snapshots” and “/.cache/huggingface/hub/models—urchade—gliner_multi-v2.1/snapshots/”.

All of these options throw the following error-

huggingface_hub.utils._errors.LocalEntryNotFoundError: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.

I am able to load the cached model using the code in step 3 on my local machine but not in the docker container.

I am using gliner version 0.2.8 and bullseye Debian.

Anyone else run into this? Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant