Local downloaded models uploading

John6666
Wed, 06 Nov 2024 10:57:54 +0000

Is this a bug?

github.com/UKPLab/sentence-transformers

2.3.0 issues loading model from local dir

opened 03:27PM - 30 Jan 24 UTC

closed 05:09PM - 30 Jan 24 UTC

wjdunlop

Encountering a problem that may be of similar origin with #2458, opening another… issue as it may not be same exact source. Our issue was with loading some old models by model path where we have moved a .tar.gz of the file. In my case, the failure got to `huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/opt/ml/model'. Use `repo_type` argument if needed.` We were loading the model in question into `/opt/ml/model` and loading it by dir name was not a problem prior to 2.3.0 Not sure if this is an issue with sentence-transformers or with some intermediate point between sentence-transformers and huggingface/transformers updates, both of which were using newer versions on this failing buidl Ultimately, reverting back to 2.2.2 fixed the issue. ```Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/sagemaker_huggingface_inference_toolkit/handler_service.py", line 243, in handle self.initialize(context) File "/opt/conda/lib/python3.10/site-packages/sagemaker_huggingface_inference_toolkit/handler_service.py", line 83, in initialize self.model = self.load(*([self.model_dir] + self.load_extra_arg)) File "/opt/ml/model/code/inference.py", line 60, in model_fn return model(model_dir) File "/opt/ml/model/code/inference.py", line 67, in model model = SentenceTransformer(model_dir, device='cuda') File "/opt/conda/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 194, in __init__ modules = self._load_sbert_model( File "/opt/conda/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 1062, in _load_sbert_model module_path = load_dir_path( File "/opt/conda/lib/python3.10/site-packages/sentence_transformers/util.py", line 537, in load_dir_path repo_path = snapshot_download(**download_kwargs) File "/opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 110, in _inner_fn validate_repo_id(arg_value) File "/opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 158, in validate_repo_id raise HFValidationError( huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/opt/ml/model'. Use `repo_type` argument if needed.```

Read full topic