huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
2.03k stars 531 forks source link

OSError: Consistency check failed: file should be of size 133466304 but has size 635 #2589

Open csw-work opened 5 days ago

csw-work commented 5 days ago

Describe the bug

I've been attempting to run new models for the sentence_transformers library today, so they're ones I've not downloaded yet. Every time the program errors at some point in the download process while attempting to download the data for the model. Here's my simple test code:

`from transformers import AutoModel, AutoTokenizer from sentence_transformers import SentenceTransformer

Force download the model using the transformers library

model_name = 'sentence-transformers/msmarco-MiniLM-L12-cos-v5'

First, force the download using AutoModel and AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(model_name, force_download=True) model = AutoModel.from_pretrained(model_name, force_download=True)

Then load the SentenceTransformer model

sentence_model = SentenceTransformer(model_name) `

All attempts even with different models are producing errors like this:

2024-10-03 15:57:45.909251: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variableTF_ENABLE_ONEDNN_OPTS=0. 2024-10-03 15:57:47.453363: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variableTF_ENABLE_ONEDNN_OPTS=0`. WARNING:tensorflow:From C:\Program Files\Python311\Lib\site-packages\tf_keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

tokenizer_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 432/432 [00:00<?, ?B/s] config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 629/629 [00:00<?, ?B/s] tokenizer_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 432/432 [00:00<?, ?B/s] vocab.txt: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 232k/232k [00:00<00:00, 2.56MB/s] tokenizer.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 466k/466k [00:00<00:00, 3.46MB/s] special_tokens_map.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 112/112 [00:00<?, ?B/s] tokenizer_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 432/432 [00:00<?, ?B/s] C:\Program Files\Python311\Lib\site-packages\transformers\tokenization_utils_base.py:1617: FutureWarning: clean_up_tokenization_spaces was not set. It will be set to True by default. This behavior will be deprecated in transformers v4.45, and will be then set to False by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884 warnings.warn( config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 629/629 [00:00<?, ?B/s] config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 629/629 [00:00<?, ?B/s] (…)pEIFb0BUQ6A&Key-Pair-Id=K3RPWS32NSSJCE: 635B [00:00, ?B/s] Traceback (most recent call last): File "c:\Users[REDACTED FOR SECURITY]\Python\VS Code Projects\troi\test_load.py", line 9, in model = AutoModel.from_pretrained(model_name, force_download=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\transformers\models\auto\auto_factory.py", line 564, in from_pretrained return model_class.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\transformers\modeling_utils.py", line 3604, in from_pretrained resolved_archive_file = cached_file(pretrained_model_name_or_path, filename, cached_file_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\transformers\utils\hub.py", line 403, in cached_file resolved_file = hf_hub_download( ^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\utils_deprecation.py", line 101, in inner_f return f(*args, *kwargs) ^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(args, kwargs) ^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\file_download.py", line 1232, in hf_hub_download return _hf_hub_download_to_cache_dir( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\file_download.py", line 1381, in _hf_hub_download_to_cache_dir _download_to_tmp_and_move( File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\file_download.py", line 1915, in _download_to_tmp_and_move http_get( File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\file_download.py", line 570, in http_get raise EnvironmentError( OSError: Consistency check failed: file should be of size 133466304 but has size 635 ((…)pEIFb0BUQ6A&Key-Pair-Id=K3RPWS32NSSJCE). We are sorry for the inconvenience. Please retry with force_download=True. If the issue persists, please let us know by opening an issue on https://github.com/huggingface/huggingface_hub.`

As a general rule it seems to always get to the first file after the config.json downloads and then it errors. As a note I've cleared out the cache multiple times , and ensured the most recent versions of transformers and sentence-transformers is installed. As recently as a week or two ago I was able to pull the models in just fine, not sure what could have changed.

Reproduction

from transformers import AutoModel, AutoTokenizer
from sentence_transformers import SentenceTransformer

# Force download the model using the transformers library
model_name = 'sentence-transformers/msmarco-MiniLM-L12-cos-v5'

# First, force the download using AutoModel and AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name, force_download=True)
model = AutoModel.from_pretrained(model_name, force_download=True)

# Then load the SentenceTransformer model
sentence_model = SentenceTransformer(model_name)

Logs

2024-10-03 15:57:45.909251: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-10-03 15:57:47.453363: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
WARNING:tensorflow:From C:\Program Files\Python311\Lib\site-packages\tf_keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

tokenizer_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 432/432 [00:00<?, ?B/s]
config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 629/629 [00:00<?, ?B/s]
tokenizer_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 432/432 [00:00<?, ?B/s]
vocab.txt: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 232k/232k [00:00<00:00, 2.56MB/s]
tokenizer.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 466k/466k [00:00<00:00, 3.46MB/s]
special_tokens_map.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 112/112 [00:00<?, ?B/s]
tokenizer_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 432/432 [00:00<?, ?B/s]
C:\Program Files\Python311\Lib\site-packages\transformers\tokenization_utils_base.py:1617: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be deprecated in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884
  warnings.warn(
config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 629/629 [00:00<?, ?B/s]
config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 629/629 [00:00<?, ?B/s]
(…)pEIFb0BUQ6A__&Key-Pair-Id=K3RPWS32NSSJCE: 635B [00:00, ?B/s]
Traceback (most recent call last):
  File "c:\Users\[REDACTED FOR SECURITY]\Python\VS Code Projects\troi\test_load.py", line 9, in <module>
    model = AutoModel.from_pretrained(model_name, force_download=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\transformers\models\auto\auto_factory.py", line 564, in from_pretrained
    return model_class.from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\transformers\modeling_utils.py", line 3604, in from_pretrained
    resolved_archive_file = cached_file(pretrained_model_name_or_path, filename, **cached_file_kwargs)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\transformers\utils\hub.py", line 403, in cached_file
    resolved_file = hf_hub_download(
                    ^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\utils\_deprecation.py", line 101, in inner_f
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\file_download.py", line 1232, in hf_hub_download
    return _hf_hub_download_to_cache_dir(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\file_download.py", line 1381, in _hf_hub_download_to_cache_dir
    _download_to_tmp_and_move(
  File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\file_download.py", line 1915, in _download_to_tmp_and_move
    http_get(
  File "C:\Program Files\Python311\Lib\site-packages\huggingface_hub\file_download.py", line 570, in http_get
    raise EnvironmentError(
OSError: Consistency check failed: file should be of size 133466304 but has size 635 ((…)pEIFb0BUQ6A__&Key-Pair-Id=K3RPWS32NSSJCE).
We are sorry for the inconvenience. Please retry with `force_download=True`.
If the issue persists, please let us know by opening an issue on https://github.com/huggingface/huggingface_hub.

System info

- huggingface_hub version: 0.25.1
- Platform: Windows-10-10.0.22631-SP0
- Python version: 3.11.4
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Running in Google Colab Enterprise ?: No
- Token path ?: C:\Users\cweems1\.cache\huggingface\token
- Has saved token ?: False
- Configured git credential helpers:
- FastAI: N/A
- Tensorflow: 2.17.0
- Torch: 2.2.2
- Jinja2: 3.1.2
- Graphviz: 0.20.3
- keras: 3.4.1
- Pydot: N/A
- Pillow: 10.1.0
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: 1.26.1
- pydantic: 2.5.2
- aiohttp: 3.9.5
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: C:\Users\cweems1\.cache\huggingface\hub
- HF_ASSETS_CACHE: C:\Users\cweems1\.cache\huggingface\assets
- HF_TOKEN_PATH: C:\Users\cweems1\.cache\huggingface\token
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10
csw-work commented 5 days ago

Update: Tested it on a separate machine (a non-work computer) and it seems to have downloaded fine. Based on the results, it looks like its the step that downloads the model.safestensors file that triggers the error.