Skip to content

Commit

Permalink
Enable hf_transfer for faster download
Browse files Browse the repository at this point in the history
  • Loading branch information
vmpuri committed Oct 9, 2024
1 parent cfeafce commit 329e2a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions install/install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ fi
set -x
$PIP_EXECUTABLE install evaluate=="0.4.3" lm-eval=="0.4.2" psutil=="6.0.0"
)

export HF_HUB_ENABLE_HF_TRANSFER=1
2 changes: 1 addition & 1 deletion install/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Requires python >=3.10

# Hugging Face download
huggingface_hub
huggingface_hub[hf_transfer]

# GGUF import
gguf
Expand Down
3 changes: 3 additions & 0 deletions torchchat/cli/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
# Both $HF_HOME and $HUGGINGFACE_HUB_CACHE are valid environment variables for the same directory.
HUGGINGFACE_HOME_PATH = Path(os.environ.get("HF_HOME", os.environ.get("HUGGINGFACE_HUB_CACHE", os.path.expanduser("~/.cache/huggingface/hub"))))

if os.environ.get("HF_HUB_ENABLE_HF_TRANSFER", None) is None:
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"

def _download_hf_snapshot(
model_config: ModelConfig, hf_token: Optional[str]
):
Expand Down

0 comments on commit 329e2a0

Please sign in to comment.