You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
My own task or dataset (give details below)
Reproduction
Issue
Models that require trust_remote_code=True can't be fully saved & loaded with save_pretrained() + from_pretrained().
In offline mode on a new machine during calling from_pretrained() it doesn't locate all required files in the saved local dir and tries to reach out to hf hub for the remote code part.
Stumbled on this in Kaggle Notebook env for competition.
Some Kaggle competitions require submitting code in Kaggle Notebooks, which are run later on private data and don't allow internet access.
Practically, this means you must prepare all models in advance, upload them as dependencies to the submission notebook.
So having transformers trying to reach out to hf-hub (when the model is already pre-downloaded) is not an option and disqualifies a group of models from usage.
System Info
Google Colab:
transformers
version: 4.46.3Who can help?
@Rocketknight1
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Issue
Models that require
trust_remote_code=True
can't be fully saved & loaded withsave_pretrained()
+from_pretrained()
.In offline mode on a new machine during calling
from_pretrained()
it doesn't locate all required files in the saved local dir and tries to reach out to hf hub for the remote code part.How to reproduce
Colab | Kaggle
Tested with popular
jinaai/jina-embeddings-v3
Includes step by step reproduction + results
Additional context
Some Kaggle competitions require submitting code in Kaggle Notebooks, which are run later on private data and don't allow internet access.
Practically, this means you must prepare all models in advance, upload them as dependencies to the submission notebook.
So having transformers trying to reach out to hf-hub (when the model is already pre-downloaded) is not an option and disqualifies a group of models from usage.
.save()
'd model withrevision
andtrust_remote_code
re-downloads code at runtime? UKPLab/sentence-transformers#2613.Received guidance by @tomaarsen in Loading a
.save()
'd model withrevision
andtrust_remote_code
re-downloads code at runtime? UKPLab/sentence-transformers#2613 (comment) to overcome the issue withsentence-transformers
(code snippet included)Expected behavior
Model is fully saved in local dir with
save_pretrained()
and can be fully loaded from a local path withfrom_pretrained()
in offline modeThe text was updated successfully, but these errors were encountered: