Skip to content

Commit

Permalink
Merge pull request #380 from backend-developers-ltd/hf-transfer
Browse files Browse the repository at this point in the history
Enable hf_transfer env var only in Dockerfile
  • Loading branch information
adal-chiriliuc-reef authored Jan 24, 2025
2 parents dbaea2d + b0f3b46 commit a279983
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions executor/app/envs/prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ RUN apt-get update \
WORKDIR /root/src/
ENV PYTHONUNBUFFERED=1
ENV PATH="/root/src/.venv/bin:$PATH"

# Enable hf_transfer download acceleration package
# https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubenablehftransfer
ENV HF_HUB_ENABLE_HF_TRANSFER=1

COPY --from=base-image /root/src/ /root/src/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import csv
import io
import logging
import os
import pathlib
import random
import re
Expand Down Expand Up @@ -390,9 +389,6 @@ def download_from_huggingface(
self, relative_path: pathlib.Path, repo_id: str, revision: str | None
):
try:
# enable hf_transfer download acceleration package
# https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubenablehftransfer
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
snapshot_download(
repo_id=repo_id,
revision=revision,
Expand Down

0 comments on commit a279983

Please sign in to comment.