Sanster/IOPaint

[BUG] ImportError: cannot import name 'cached_download' from 'huggingface_hub'

Closed this issue · 1 comments

Model
N/A

Describe the bug
Ran win_setup.bat without issue but getting the following error when running win_config.bat:
ImportError: cannot import name 'cached_download' from 'huggingface_hub' (C:\IOPaint-v1.1\installer\lib\site-packages\huggingface_hub\__init__.py)

Screenshots
Full output:

PS C:\IOPaint-v1.1> .\win_config.bat
- Platform: Windows-10-10.0.19045-SP0
- Python version: 3.10.6
- torch: 2.1.2+cu118
- torchvision: 0.16.2+cu118
- Pillow: 9.5.0
- diffusers: 0.27.2
- transformers: 4.45.2
- opencv-python: 4.10.0.84
- accelerate: 1.0.1
- iopaint: 1.4.3
- rembg: 2.0.59

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ C:\IOPaint-v1.1\installer\lib\site-packages\iopaint\cli.py:230 in start_web_config                                                                                                                                                        │
│                                                                                                                                                                                                                                                                          │
│   227 │   config_file: Path = Option("config.json"),                                                                                                                                                                                                                     │
│   228 ):                                                                                                                                                                                                                                                                 │
│   229 │   dump_environment_info()                                                                                                                                                                                                                                        │
│ ❱ 230 │   from iopaint.web_config import main                                                                                                                                                                                                                            │
│   231 │                                                                                                                                                                                                                                                                  │
│   232 │   main(config_file)                                                                                                                                                                                                                                              │
│   233                                                                                                                                                                                                                                                                    │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\iopaint\web_config.py:26 in <module>                                                                                                                                                          │
│                                                                                                                                                                                                                                                                          │
│    23 from json import JSONDecodeError                                                                                                                                                                                                                                   │
│    24                                                                                                                                                                                                                                                                    │
│    25 import gradio as gr                                                                                                                                                                                                                                                │
│ ❱  26 from iopaint.download import scan_models                                                                                                                                                                                                                           │
│    27 from loguru import logger                                                                                                                                                                                                                                          │
│    28                                                                                                                                                                                                                                                                    │
│    29 from iopaint.const import *                                                                                                                                                                                                                                        │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\iopaint\download.py:19 in <module>                                                                                                                                                            │
│                                                                                                                                                                                                                                                                          │
│    16 │   DIFFUSERS_SDXL_INPAINT_CLASS_NAME,                                                                                                                                                                                                                             │
│    17 │   ANYTEXT_NAME,                                                                                                                                                                                                                                                  │
│    18 )                                                                                                                                                                                                                                                                  │
│ ❱  19 from iopaint.model.original_sd_configs import get_config_files                                                                                                                                                                                                     │
│    20                                                                                                                                                                                                                                                                    │
│    21                                                                                                                                                                                                                                                                    │
│    22 def cli_download_model(model: str):                                                                                                                                                                                                                                │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\iopaint\model\__init__.py:1 in <module>                                                                                                                                                       │
│                                                                                                                                                                                                                                                                          │
│ ❱  1 from .anytext.anytext_model import AnyText                                                                                                                                                                                                                          │
│    2 from .controlnet import ControlNet                                                                                                                                                                                                                                  │
│    3 from .fcf import FcF                                                                                                                                                                                                                                                │
│    4 from .instruct_pix2pix import InstructPix2Pix                                                                                                                                                                                                                       │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\iopaint\model\anytext\anytext_model.py:5 in <module>                                                                                                                                          │
│                                                                                                                                                                                                                                                                          │
│    2 from huggingface_hub import hf_hub_download                                                                                                                                                                                                                         │
│    3                                                                                                                                                                                                                                                                     │
│    4 from iopaint.const import ANYTEXT_NAME                                                                                                                                                                                                                              │
│ ❱  5 from iopaint.model.anytext.anytext_pipeline import AnyTextPipeline                                                                                                                                                                                                  │
│    6 from iopaint.model.base import DiffusionInpaintModel                                                                                                                                                                                                                │
│    7 from iopaint.model.utils import get_torch_dtype, is_local_files_only                                                                                                                                                                                                │
│    8 from iopaint.schema import InpaintRequest                                                                                                                                                                                                                           │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\iopaint\model\anytext\anytext_pipeline.py:10 in <module>                                                                                                                                      │
│                                                                                                                                                                                                                                                                          │
│     7 import os                                                                                                                                                                                                                                                          │
│     8 from pathlib import Path                                                                                                                                                                                                                                           │
│     9                                                                                                                                                                                                                                                                    │
│ ❱  10 from iopaint.model.utils import set_seed                                                                                                                                                                                                                           │
│    11 from safetensors.torch import load_file                                                                                                                                                                                                                            │
│    12                                                                                                                                                                                                                                                                    │
│    13 os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"                                                                                                                                                                                                                           │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\iopaint\model\utils.py:12 in <module>                                                                                                                                                         │
│                                                                                                                                                                                                                                                                          │
│      9 import collections                                                                                                                                                                                                                                                │
│     10 from itertools import repeat                                                                                                                                                                                                                                      │
│     11                                                                                                                                                                                                                                                                   │
│ ❱   12 from diffusers import (                                                                                                                                                                                                                                           │
│     13 │   DDIMScheduler,                                                                                                                                                                                                                                                │
│     14 │   PNDMScheduler,                                                                                                                                                                                                                                                │
│     15 │   LMSDiscreteScheduler,                                                                                                                                                                                                                                         │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\diffusers\__init__.py:5 in <module>                                                                                                                                                           │
│                                                                                                                                                                                                                                                                          │
│     2                                                                                                                                                                                                                                                                    │
│     3 from typing import TYPE_CHECKING                                                                                                                                                                                                                                   │
│     4                                                                                                                                                                                                                                                                    │
│ ❱   5 from .utils import (                                                                                                                                                                                                                                               │
│     6 │   DIFFUSERS_SLOW_IMPORT,                                                                                                                                                                                                                                         │
│     7 │   OptionalDependencyNotAvailable,                                                                                                                                                                                                                                │
│     8 │   _LazyModule,                                                                                                                                                                                                                                                   │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\diffusers\utils\__init__.py:38 in <module>                                                                                                                                                    │
│                                                                                                                                                                                                                                                                          │
│    35 )                                                                                                                                                                                                                                                                  │
│    36 from .deprecation_utils import deprecate                                                                                                                                                                                                                           │
│    37 from .doc_utils import replace_example_docstring                                                                                                                                                                                                                   │
│ ❱  38 from .dynamic_modules_utils import get_class_from_dynamic_module                                                                                                                                                                                                   │
│    39 from .export_utils import export_to_gif, export_to_obj, export_to_ply, export_to_video                                                                                                                                                                             │
│    40 from .hub_utils import (                                                                                                                                                                                                                                           │
│    41 │   PushToHubMixin,                                                                                                                                                                                                                                                │
│                                                                                                                                                                                                                                                                          │
│ C:\IOPaint-v1.1\installer\lib\site-packages\diffusers\utils\dynamic_modules_utils.py:28 in <module>                                                                                                                                       │
│                                                                                                                                                                                                                                                                          │
│    25 from typing import Dict, Optional, Union                                                                                                                                                                                                                           │
│    26 from urllib import request                                                                                                                                                                                                                                         │
│    27                                                                                                                                                                                                                                                                    │
│ ❱  28 from huggingface_hub import cached_download, hf_hub_download, model_info                                                                                                                                                                                           │
│    29 from huggingface_hub.utils import validate_hf_hub_args                                                                                                                                                                                                             │
│    30 from packaging import version                                                                                                                                                                                                                                      │
│    31                                                                                                                                                                                                                                                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'cached_download' from 'huggingface_hub' (C:\IOPaint-v1.1\installer\lib\site-packages\huggingface_hub\__init__.py)

System Info
Software version used

  • Platform: Windows-10-10.0.19045-SP0
  • Python version: 3.10.6
  • torch: 2.1.2+cu118
  • torchvision: 0.16.2+cu118
  • Pillow: 9.5.0
  • diffusers: 0.27.2
  • transformers: 4.45.2
  • opencv-python: 4.10.0.84
  • accelerate: 1.0.1
  • iopaint: 1.4.3
  • rembg: 2.0.59

This is due to API compatibility issues caused by the upgrade of huggingface_hub, which has been fixed in IOPaint 1.4.4.