

feat: enable faster model downloads with `hf_transfer` (#207)
@3a7de41b17f94635271e7091e4b5dfe3b1fb8fa6
--- Dockerfile
+++ Dockerfile
... | ... | @@ -30,5 +30,7 @@ |
30 | 30 |
ENV UVICORN_HOST=0.0.0.0 |
31 | 31 |
ENV UVICORN_PORT=8000 |
32 | 32 |
ENV PATH="$HOME/faster-whisper-server/.venv/bin:$PATH" |
33 |
+# https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables#hfhubenablehftransfer |
|
34 |
+ENV HF_HUB_ENABLE_HF_TRANSFER=1 |
|
33 | 35 |
EXPOSE 8000 |
34 | 36 |
CMD ["uvicorn", "--factory", "faster_whisper_server.main:create_app"] |
--- pyproject.toml
+++ pyproject.toml
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 |
"ctranslate2>=4.5.0", |
8 | 8 |
"fastapi>=0.115.0", |
9 | 9 |
"faster-whisper>=1.1.0", |
10 |
- "huggingface-hub>=0.25.1", |
|
10 |
+ "huggingface-hub[hf-transfer]>=0.25.1", |
|
11 | 11 |
"numpy>=2.1.1", |
12 | 12 |
"piper-phonemize ; platform_machine == 'x86_64'", |
13 | 13 |
"piper-tts>=1.2.0 ; platform_machine == 'x86_64'", |
--- uv.lock
+++ uv.lock
... | ... | @@ -274,7 +274,7 @@ |
274 | 274 |
{ name = "ctranslate2" }, |
275 | 275 |
{ name = "fastapi" }, |
276 | 276 |
{ name = "faster-whisper" }, |
277 |
- { name = "huggingface-hub" }, |
|
277 |
+ { name = "huggingface-hub", extra = ["hf-transfer"] }, |
|
278 | 278 |
{ name = "numpy" }, |
279 | 279 |
{ name = "piper-phonemize", marker = "platform_machine == 'x86_64'" }, |
280 | 280 |
{ name = "piper-tts", marker = "platform_machine == 'x86_64'" }, |
... | ... | @@ -335,7 +335,7 @@ |
335 | 335 |
{ name = "gradio", marker = "extra == 'ui'", specifier = ">=5.0.2" }, |
336 | 336 |
{ name = "httpx", marker = "extra == 'ui'", specifier = ">=0.27.2" }, |
337 | 337 |
{ name = "httpx-sse", marker = "extra == 'ui'", specifier = ">=0.4.0" }, |
338 |
- { name = "huggingface-hub", specifier = ">=0.25.1" }, |
|
338 |
+ { name = "huggingface-hub", extras = ["hf-transfer"], specifier = ">=0.25.1" }, |
|
339 | 339 |
{ name = "keyboard", marker = "extra == 'client'", specifier = ">=0.13.5" }, |
340 | 340 |
{ name = "mkdocs-material", marker = "extra == 'dev'", specifier = ">=9.5.39" }, |
341 | 341 |
{ name = "mkdocstrings", extras = ["python"], marker = "extra == 'dev'", specifier = ">=0.26.1" }, |
... | ... | @@ -523,6 +523,23 @@ |
523 | 523 |
] |
524 | 524 |
|
525 | 525 |
[[package]] |
526 |
+name = "hf-transfer" |
|
527 |
+version = "0.1.8" |
|
528 |
+source = { registry = "https://pypi.org/simple" } |
|
529 |
+sdist = { url = "https://files.pythonhosted.org/packages/d3/0e/ba51e31148f0a9bc8d44878086535c2dc6d9a8dce321250e9bcdd3c110ea/hf_transfer-0.1.8.tar.gz", hash = "sha256:26d229468152e7a3ec12664cac86b8c2800695fd85f9c9a96677a775cc04f0b3", size = 23595 } |
|
530 |
+wheels = [ |
|
531 |
+ { url = "https://files.pythonhosted.org/packages/5b/d6/54c9ea16c782cb79cdae78500c0a4bc7474236f94537ee954771e6e86c8c/hf_transfer-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:baf948f4f493949309cbe60529620b9b0aef854a22b6e526753364acc57c09b6", size = 1424195 }, |
|
532 |
+ { url = "https://files.pythonhosted.org/packages/63/57/09e2aa7fa63bc640d9c3fda2cc724744b46227d239bb4ae9bf33efc338c2/hf_transfer-0.1.8-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0bce5c8bdefa478c5d5eaa646cc4ce1df5cfe764d98572ad0c6b8773e98d49f6", size = 1408105 }, |
|
533 |
+ { url = "https://files.pythonhosted.org/packages/19/72/f247f9632410d8b9655332b2007924557c293094ea91648336f49403afe7/hf_transfer-0.1.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54d6f8a1a86128d651a3799e1267c343d60f81f2c565d7c5416eb8e674e4cf0e", size = 3782066 }, |
|
534 |
+ { url = "https://files.pythonhosted.org/packages/d0/cf/8eccb6fcff8eedd79334ffaf65c44109e8bece1ecc232c1036de697d51fa/hf_transfer-0.1.8-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f79fd1b0c2ed93efb4c5f684118d7a762ecdd218e170df8208c4e13d3dcd4959", size = 3103992 }, |
|
535 |
+ { url = "https://files.pythonhosted.org/packages/23/e8/f5d4ef6febc9ece1099e1f8de64f05f4d9f5b62461c4e54aac324a94d1ab/hf_transfer-0.1.8-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:414df35692670683bf5623498ef9d88a8df5d77e9516515da6e2b34d1054c11f", size = 3590083 }, |
|
536 |
+ { url = "https://files.pythonhosted.org/packages/aa/de/cd8b36ecfd1c40119f307cb0dfd4ca5cd437beb8c92219d52a4253e0059a/hf_transfer-0.1.8-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c9798d5f951f66b96d40a7a53910260cb5874fda56cf5944dddb7c571f37ec3", size = 3406261 }, |
|
537 |
+ { url = "https://files.pythonhosted.org/packages/37/7f/914b684779dae9d2db4cdb6efa50426da7411754d820b8ddc9c10eef5042/hf_transfer-0.1.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:060c661691f85a61392e57579c80eb64b5ee277434e81fb582f605c1c8ff05d5", size = 3560705 }, |
|
538 |
+ { url = "https://files.pythonhosted.org/packages/de/17/e9ff11be0ab52d113091462f65fa280bd5c04c80e5b1dadb7f8de9645848/hf_transfer-0.1.8-cp312-none-win32.whl", hash = "sha256:f7840e32379820c3e1571a480238e05ea043e970c99d2e999578004a2eb17788", size = 1130448 }, |
|
539 |
+ { url = "https://files.pythonhosted.org/packages/58/60/04c18bbeb46cc2dc6fd237323c03f2e4c700bca122f28567dbb344ff5bab/hf_transfer-0.1.8-cp312-none-win_amd64.whl", hash = "sha256:9a3204ec423cc5e659872e8179f8704ad9ce2abb1e6a991f8838aedf1dc07830", size = 1206317 }, |
|
540 |
+] |
|
541 |
+ |
|
542 |
+[[package]] |
|
526 | 543 |
name = "httpcore" |
527 | 544 |
version = "1.0.5" |
528 | 545 |
source = { registry = "https://pypi.org/simple" } |
... | ... | @@ -578,6 +595,11 @@ |
578 | 595 |
{ url = "https://files.pythonhosted.org/packages/5f/f1/15dc793cb109a801346f910a6b350530f2a763a6e83b221725a0bcc1e297/huggingface_hub-0.25.1-py3-none-any.whl", hash = "sha256:a5158ded931b3188f54ea9028097312cb0acd50bffaaa2612014c3c526b44972", size = 436438 }, |
579 | 596 |
] |
580 | 597 |
|
598 |
+[package.optional-dependencies] |
|
599 |
+hf-transfer = [ |
|
600 |
+ { name = "hf-transfer" }, |
|
601 |
+] |
|
602 |
+ |
|
581 | 603 |
[[package]] |
582 | 604 |
name = "humanfriendly" |
583 | 605 |
version = "10.0" |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?