yonikremer commited on
Commit
2c1c246
1 Parent(s): bb33aa7

deleted download_repo.py

Browse files
Files changed (1) hide show
  1. download_repo.py +0 -45
download_repo.py DELETED
@@ -1,45 +0,0 @@
1
- import urllib3
2
-
3
- from huggingface_hub import snapshot_download
4
-
5
- from available_models import AVAILABLE_MODELS
6
-
7
-
8
- def change_default_timeout(new_timeout: int) -> None:
9
- """
10
- Changes the default timeout for downloading repositories from the Hugging Face Hub.
11
- Prevents the following errors:
12
- urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='huggingface.co', port=443):
13
- Read timed out. (read timeout=10)
14
- """
15
- urllib3.util.timeout.DEFAULT_TIMEOUT = new_timeout
16
-
17
-
18
- def download_pytorch_model(name: str) -> None:
19
- """
20
- Downloads a pytorch model and all the small files from the model's repository.
21
- Other model formats (tensorflow, tflite, safetensors, msgpack, ot...) are not downloaded.
22
- """
23
- number_of_seconds_in_a_year: int = 60 * 60 * 24 * 365
24
- change_default_timeout(number_of_seconds_in_a_year)
25
- snapshot_download(
26
- repo_id=name,
27
- etag_timeout=number_of_seconds_in_a_year,
28
- resume_download=True,
29
- repo_type="model",
30
- library_name="pt",
31
- # h5, tflite, safetensors, msgpack and ot models files are not needed
32
- ignore_patterns=[
33
- "*.h5",
34
- "*.tflite",
35
- "*.safetensors",
36
- "*.msgpack",
37
- "*.ot",
38
- "*.md"
39
- ],
40
- )
41
-
42
-
43
- if __name__ == "__main__":
44
- for model_name in AVAILABLE_MODELS:
45
- download_pytorch_model(model_name)