Skip to content

Commit

Permalink
Merge pull request #378 from backend-developers-ltd/hf-transfer
Browse files Browse the repository at this point in the history
Enable huggingface hf_transfer
  • Loading branch information
adal-chiriliuc-reef authored Jan 24, 2025
2 parents 1cb2235 + 1b440ee commit 1b9fc5f
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 89 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/executor_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand All @@ -50,9 +50,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand All @@ -76,9 +76,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/library_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand All @@ -50,9 +50,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand All @@ -74,9 +74,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/miner_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand All @@ -50,9 +50,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand All @@ -76,9 +76,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/validator_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand All @@ -50,9 +50,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand All @@ -76,9 +76,9 @@ jobs:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5
with:
version: "0.5.3"
version: "latest"
enable-cache: true
- name: Install dependencies
run: python -m pip install --upgrade nox
Expand Down
1 change: 1 addition & 0 deletions executor/app/envs/prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN apt-get update \
WORKDIR /root/src/
ENV PYTHONUNBUFFERED=1
ENV PATH="/root/src/.venv/bin:$PATH"
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,6 +3,7 @@
import csv
import io
import logging
import os
import pathlib
import random
import re
Expand Down Expand Up @@ -389,6 +390,9 @@ 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
2 changes: 1 addition & 1 deletion executor/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = [
"prometheus-client~=0.17.0",
"django-prometheus==2.3.1",
"django-business-metrics @ git+https://github.com/reef-technologies/django-business-metrics.git@9d08ddb3a9d26e8a7e478110d7c8c34c3aa03a01",
"huggingface-hub>=0.26.1",
"huggingface-hub[hf_transfer]>=0.26.1",
]

[tool.uv.sources]
Expand Down
48 changes: 32 additions & 16 deletions executor/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion miner/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
"prometheus-client~=0.17.0",
"django-prometheus==2.3.1",
"django-business-metrics @ git+https://github.com/reef-technologies/django-business-metrics.git@9d08ddb3a9d26e8a7e478110d7c8c34c3aa03a01",
"django-constance[database]==3.1.0",
"django-constance==3.1.0",
]

[tool.uv.sources]
Expand Down
Loading

0 comments on commit 1b9fc5f

Please sign in to comment.