Compare commits

...

10 Commits

Author SHA1 Message Date
Wauplin
40e10daced setup.py 2025-09-25 13:16:17 +02:00
Wauplin
8851af80a2 this time? 2025-09-25 12:00:52 +02:00
Wauplin
bbf5890a07 install compel separately 2025-09-25 11:50:13 +02:00
Wauplin
4eccafe490 tmp remove transformers from deps 2025-09-25 11:27:41 +02:00
Wauplin
2e08fd1bdd install transformers from main 2025-09-25 11:19:03 +02:00
Wauplin
80b9ad6c2d allow prerelease 2025-09-24 16:31:34 +02:00
Wauplin
09a251fef2 run on python 3.9 2025-09-24 16:17:02 +02:00
Wauplin
d757bf5045 install transformers from source 2025-09-24 15:59:27 +02:00
Wauplin
cc173a0d20 fixup 2025-09-24 15:56:55 +02:00
Wauplin
f27b673c44 let's try it out 2025-09-24 15:44:39 +02:00
23 changed files with 102 additions and 57 deletions

View File

@@ -40,6 +40,8 @@ jobs:
apt install -y libpq-dev postgresql-client
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
python -m uv pip install -r benchmarks/requirements.txt
- name: Environment
run: |

View File

@@ -76,6 +76,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install --upgrade huggingface_hub
pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
# Check secret is set
- name: whoami

View File

@@ -75,6 +75,7 @@ jobs:
python -m uv pip install -e [quality,test]
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
python -m uv pip install pytest-reportlog
python -m uv pip install compel==0.1.8
- name: Environment
run: |
python utils/print_env.py
@@ -129,6 +130,7 @@ jobs:
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
python -m uv pip install pytest-reportlog
python -m uv pip install compel==0.1.8
- name: Environment
run: python utils/print_env.py
@@ -237,6 +239,7 @@ jobs:
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
python -m uv pip install pytest-reportlog
python -m uv pip install compel==0.1.8
- name: Environment
run: |
python utils/print_env.py
@@ -286,6 +289,7 @@ jobs:
python -m uv pip install -e [quality,test]
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
python -m uv pip install compel==0.1.8
- name: Environment
run: |

View File

@@ -22,13 +22,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m pip install --upgrade pip uv
python -m uv pip install -e .
python -m uv pip install --prerelease=allow -e .
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install pytest
python -m uv pip install compel==0.1.8
- name: Check for soft dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"

View File

@@ -44,6 +44,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install .[quality]
pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
- name: Check quality
run: make quality
- name: Check if failure
@@ -64,6 +65,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install .[quality]
pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
- name: Check repo consistency
run: |
python utils/check_copies.py
@@ -109,9 +111,10 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
python -m uv pip install compel==0.1.8
- name: Environment
run: |

View File

@@ -34,7 +34,9 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
- name: Environment
run: |
python utils/print_env.py
@@ -92,7 +94,9 @@ jobs:
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m pip install -e [quality,test]
python -m pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
python -m pip install accelerate
python -m uv pip install compel==0.1.8
- name: Environment
run: |
@@ -149,7 +153,9 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
python -m pip install -e [quality,test]
python -m uv pip install compel==0.1.8
- name: Environment
run: |

View File

@@ -35,11 +35,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[quality]
pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
- name: Check quality
run: make quality
- name: Check if failure
@@ -55,11 +56,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[quality]
pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
- name: Check repo consistency
run: |
python utils/check_copies.py
@@ -115,9 +117,10 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
python -m uv pip install compel==0.1.8
- name: Environment
run: |
@@ -196,7 +199,9 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
- name: Environment
run: |
@@ -250,12 +255,13 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
# TODO (sayakpaul, DN6): revisit `--no-deps`
python -m pip install -U peft@git+https://github.com/huggingface/peft.git --no-deps
python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
python -m uv pip install -U tokenizers
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git --no-deps
python -m uv pip install compel==0.1.8
- name: Environment
run: |

View File

@@ -36,11 +36,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[quality]
pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
- name: Check quality
run: make quality
- name: Check if failure
@@ -56,11 +57,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[quality]
pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
- name: Check repo consistency
run: |
python utils/check_copies.py
@@ -89,7 +91,9 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
- name: Environment
run: |
python utils/print_env.py
@@ -131,9 +135,10 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
python -m uv pip install compel==0.1.8
- name: Environment
run: |
@@ -201,10 +206,11 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
python -m uv pip install compel==0.1.8
- name: Environment
run: |
@@ -267,7 +273,8 @@ jobs:
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps
python -m uv pip install -e [quality,test,training]
python -m uv pip install --prerelease=allow -e [quality,test,training]
python -m uv pip install compel==0.1.8
- name: Environment
run: |

View File

@@ -22,14 +22,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m pip install --upgrade pip uv
python -m uv pip install -e .
python -m uv pip install --prerelease=allow -e .
python -m uv pip install torch torchvision torchaudio
python -m uv pip install pytest
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
- name: Check for soft dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"

View File

@@ -35,7 +35,9 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
- name: Environment
run: |
python utils/print_env.py
@@ -76,8 +78,10 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
python -m uv pip install compel==0.1.8
- name: Environment
run: |
python utils/print_env.py
@@ -127,9 +131,10 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
python -m uv pip install compel==0.1.8
- name: Environment
run: |
@@ -181,7 +186,9 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test,training]
python -m uv pip install --prerelease=allow -e [quality,test,training]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
- name: Environment
run: |
python utils/print_env.py
@@ -224,7 +231,9 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test,training]
python -m uv pip install --prerelease=allow -e [quality,test,training]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
- name: Environment
run: |
python utils/print_env.py
@@ -265,7 +274,9 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test,training]
python -m uv pip install --prerelease=allow -e [quality,test,training]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install compel==0.1.8
- name: Environment
run: |

View File

@@ -61,7 +61,7 @@ jobs:
- name: Install dependencies
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow -e [quality,test]
- name: Environment
run: |

View File

@@ -41,10 +41,11 @@ jobs:
shell: arch -arch arm64 bash {0}
run: |
${CONDA_RUN} python -m pip install --upgrade pip uv
${CONDA_RUN} python -m uv pip install -e ".[quality,test]"
${CONDA_RUN} python -m uv pip install --prerelease=allow -e ".[quality,test]"
${CONDA_RUN} python -m uv pip install torch torchvision torchaudio
${CONDA_RUN} python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
${CONDA_RUN} python -m uv pip install transformers --upgrade
${CONDA_RUN} python -m uv pip install compel==0.1.8
- name: Environment
shell: arch -arch arm64 bash {0}

View File

@@ -20,7 +20,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: "3.9"
- name: Fetch latest branch
id: fetch_latest_branch
@@ -47,14 +47,14 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel twine
pip install -U torch --index-url https://download.pytorch.org/whl/cpu
pip install -U transformers
pip install git+https://github.com/huggingface/transformers.git # temporary (only for tests)
- name: Build the dist files
run: python setup.py bdist_wheel && python setup.py sdist

View File

@@ -65,10 +65,12 @@ jobs:
run: |
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
python -m uv pip install -e [quality,test]
python -m uv pip install --prerelease=allow "transformers @ git+https://github.com/huggingface/transformers.git" # temporary (only for tests)
python -m uv pip install peft
python -m uv pip install compel==0.1.8
- name: Run tests
env:
PY_TEST: ${{ github.event.inputs.test }}
PY_TEST: ${{ github.event.inputs.test }}
run: |
pytest "$PY_TEST"

View File

@@ -97,12 +97,12 @@ from setuptools import Command, find_packages, setup
_deps = [
"Pillow", # keep the PIL.Image.Resampling deprecation away
"accelerate>=0.31.0",
"compel==0.1.8",
"datasets",
"filelock",
"flax>=0.4.1",
"hf-doc-builder>=0.3.0",
"huggingface-hub>=0.34.0",
"httpx",
"huggingface-hub==1.0.0.rc1",
"requests-mock==1.10.0",
"importlib_metadata",
"invisible-watermark>=0.2.0",
@@ -139,7 +139,7 @@ _deps = [
"tiktoken>=0.7.0",
"torch>=1.4",
"torchvision",
"transformers>=4.41.2",
# "transformers>=4.41.2", # tmp for tests
"urllib3<=2.0.0",
"black",
"phonemizer",
@@ -219,7 +219,6 @@ extras["quality"] = deps_list("urllib3", "isort", "ruff", "hf-doc-builder")
extras["docs"] = deps_list("hf-doc-builder")
extras["training"] = deps_list("accelerate", "datasets", "protobuf", "tensorboard", "Jinja2", "peft")
extras["test"] = deps_list(
"compel",
"GitPython",
"datasets",
"Jinja2",
@@ -236,7 +235,7 @@ extras["test"] = deps_list(
"scipy",
"tiktoken",
"torchvision",
"transformers",
# "transformers",
"phonemizer",
)
extras["torch"] = deps_list("torch", "accelerate")
@@ -259,6 +258,7 @@ extras["dev"] = (
install_requires = [
deps["importlib_metadata"],
deps["filelock"],
deps["httpx"],
deps["huggingface-hub"],
deps["numpy"],
deps["regex"],

View File

@@ -30,11 +30,11 @@ import numpy as np
from huggingface_hub import DDUFEntry, create_repo, hf_hub_download
from huggingface_hub.utils import (
EntryNotFoundError,
HfHubHTTPError,
RepositoryNotFoundError,
RevisionNotFoundError,
validate_hf_hub_args,
)
from requests import HTTPError
from typing_extensions import Self
from . import __version__
@@ -419,7 +419,7 @@ class ConfigMixin:
raise EnvironmentError(
f"{pretrained_model_name_or_path} does not appear to have a file named {cls.config_name}."
)
except HTTPError as err:
except HfHubHTTPError as err:
raise EnvironmentError(
"There was a specific connection error when trying to load"
f" {pretrained_model_name_or_path}:\n{err}"

View File

@@ -4,12 +4,12 @@
deps = {
"Pillow": "Pillow",
"accelerate": "accelerate>=0.31.0",
"compel": "compel==0.1.8",
"datasets": "datasets",
"filelock": "filelock",
"flax": "flax>=0.4.1",
"hf-doc-builder": "hf-doc-builder>=0.3.0",
"huggingface-hub": "huggingface-hub>=0.34.0",
"httpx": "httpx",
"huggingface-hub": "huggingface-hub==1.0.0.rc1",
"requests-mock": "requests-mock==1.10.0",
"importlib_metadata": "importlib_metadata",
"invisible-watermark": "invisible-watermark>=0.2.0",
@@ -46,7 +46,6 @@ deps = {
"tiktoken": "tiktoken>=0.7.0",
"torch": "torch>=1.4",
"torchvision": "torchvision",
"transformers": "transformers>=4.41.2",
"urllib3": "urllib3<=2.0.0",
"black": "black",
"phonemizer": "phonemizer",

View File

@@ -26,11 +26,11 @@ from flax.traverse_util import flatten_dict, unflatten_dict
from huggingface_hub import create_repo, hf_hub_download
from huggingface_hub.utils import (
EntryNotFoundError,
HfHubHTTPError,
RepositoryNotFoundError,
RevisionNotFoundError,
validate_hf_hub_args,
)
from requests import HTTPError
from .. import __version__, is_torch_available
from ..utils import (
@@ -385,7 +385,7 @@ class FlaxModelMixin(PushToHubMixin):
raise EnvironmentError(
f"{pretrained_model_name_or_path} does not appear to have a file named {FLAX_WEIGHTS_NAME}."
)
except HTTPError as err:
except HfHubHTTPError as err:
raise EnvironmentError(
f"There was a specific connection error when trying to load {pretrained_model_name_or_path}:\n"
f"{err}"

View File

@@ -19,12 +19,12 @@ import warnings
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Union
import httpx
import requests
import torch
from huggingface_hub import DDUFEntry, ModelCard, model_info, snapshot_download
from huggingface_hub.utils import OfflineModeIsEnabled, validate_hf_hub_args
from huggingface_hub.utils import HfHubHTTPError, OfflineModeIsEnabled, validate_hf_hub_args
from packaging import version
from requests.exceptions import HTTPError
from .. import __version__
from ..utils import (
@@ -1110,7 +1110,7 @@ def _download_dduf_file(
if not local_files_only:
try:
info = model_info(pretrained_model_name, token=token, revision=revision)
except (HTTPError, OfflineModeIsEnabled, requests.ConnectionError) as e:
except (HfHubHTTPError, OfflineModeIsEnabled, requests.ConnectionError, httpx.NetworkError) as e:
logger.warning(f"Couldn't connect to the Hub: {e}.\nWill try to load from local cache.")
local_files_only = True
model_info_call_error = e # save error to reraise it if model is not cached locally

View File

@@ -23,6 +23,7 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Union, get_args, get_origin
import httpx
import numpy as np
import PIL.Image
import requests
@@ -36,9 +37,8 @@ from huggingface_hub import (
read_dduf_file,
snapshot_download,
)
from huggingface_hub.utils import OfflineModeIsEnabled, validate_hf_hub_args
from huggingface_hub.utils import HfHubHTTPError, OfflineModeIsEnabled, validate_hf_hub_args
from packaging import version
from requests.exceptions import HTTPError
from tqdm.auto import tqdm
from typing_extensions import Self
@@ -1616,7 +1616,7 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
if not local_files_only:
try:
info = model_info(pretrained_model_name, token=token, revision=revision)
except (HTTPError, OfflineModeIsEnabled, requests.ConnectionError) as e:
except (HfHubHTTPError, OfflineModeIsEnabled, requests.ConnectionError, httpx.NetworkError) as e:
logger.warning(f"Couldn't connect to the Hub: {e}.\nWill try to load from local cache.")
local_files_only = True
model_info_call_error = e # save error to reraise it if model is not cached locally

View File

@@ -38,13 +38,13 @@ from huggingface_hub.constants import HF_HUB_DISABLE_TELEMETRY, HF_HUB_OFFLINE
from huggingface_hub.file_download import REGEX_COMMIT_HASH
from huggingface_hub.utils import (
EntryNotFoundError,
HfHubHTTPError,
RepositoryNotFoundError,
RevisionNotFoundError,
is_jinja_available,
validate_hf_hub_args,
)
from packaging import version
from requests import HTTPError
from .. import __version__
from .constants import (
@@ -316,7 +316,7 @@ def _get_model_file(
raise EnvironmentError(
f"{pretrained_model_name_or_path} does not appear to have a file named {weights_name}."
) from e
except HTTPError as e:
except HfHubHTTPError as e:
raise EnvironmentError(
f"There was a specific connection error when trying to load {pretrained_model_name_or_path}:\n{e}"
) from e
@@ -432,7 +432,7 @@ def _get_checkpoint_shard_files(
# We have already dealt with RepositoryNotFoundError and RevisionNotFoundError when getting the index, so
# we don't have to catch them here. We have also dealt with EntryNotFoundError.
except HTTPError as e:
except HfHubHTTPError as e:
raise EnvironmentError(
f"We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}' to load {pretrained_model_name_or_path}. You should try"
" again after checking your internet connection."

View File

@@ -37,9 +37,8 @@ import torch
import torch.nn as nn
from accelerate.utils.modeling import _get_proper_dtype, compute_module_sizes, dtype_byte_size
from huggingface_hub import ModelCard, delete_repo, snapshot_download, try_to_load_from_cache
from huggingface_hub.utils import is_jinja_available
from huggingface_hub.utils import HfHubHTTPError, is_jinja_available
from parameterized import parameterized
from requests.exceptions import HTTPError
from diffusers.models import FluxTransformer2DModel, SD3Transformer2DModel, UNet2DConditionModel
from diffusers.models.attention_processor import (
@@ -272,7 +271,7 @@ class ModelUtilsTest(unittest.TestCase):
response_mock = mock.Mock()
response_mock.status_code = 500
response_mock.headers = {}
response_mock.raise_for_status.side_effect = HTTPError
response_mock.raise_for_status.side_effect = HfHubHTTPError("Server down", response=mock.Mock())
response_mock.json.return_value = {}
# Download this model to make sure it's in the cache.
@@ -296,7 +295,7 @@ class ModelUtilsTest(unittest.TestCase):
error_response = mock.Mock(
status_code=500,
headers={},
raise_for_status=mock.Mock(side_effect=HTTPError),
raise_for_status=mock.Mock(side_effect=HfHubHTTPError("Server down", response=mock.Mock())),
json=mock.Mock(return_value={}),
)

View File

@@ -33,9 +33,9 @@ import safetensors.torch
import torch
import torch.nn as nn
from huggingface_hub import snapshot_download
from huggingface_hub.utils import HfHubHTTPError
from parameterized import parameterized
from PIL import Image
from requests.exceptions import HTTPError
from transformers import CLIPImageProcessor, CLIPModel, CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
@@ -430,7 +430,7 @@ class DownloadTests(unittest.TestCase):
response_mock = mock.Mock()
response_mock.status_code = 500
response_mock.headers = {}
response_mock.raise_for_status.side_effect = HTTPError
response_mock.raise_for_status.side_effect = HfHubHTTPError("Server down", response=mock.Mock())
response_mock.json.return_value = {}
# Download this model to make sure it's in the cache.
@@ -457,7 +457,7 @@ class DownloadTests(unittest.TestCase):
response_mock = mock.Mock()
response_mock.status_code = 500
response_mock.headers = {}
response_mock.raise_for_status.side_effect = HTTPError
response_mock.raise_for_status.side_effect = HfHubHTTPError("Server down", response=mock.Mock())
response_mock.json.return_value = {}
# first check that with local files only the pipeline can only be used if cached