Skip to content

Commit 660d7c8

Browse files
committed
typing
1 parent 7602952 commit 660d7c8

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/diffusers/models/model_loading_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
import os
2020
from collections import OrderedDict
2121
from pathlib import Path
22-
from typing import List, Optional, Union
22+
from typing import Dict, List, Optional, Union
2323

2424
import safetensors
2525
import torch
26+
from huggingface_hub import DDUFEntry
2627
from huggingface_hub.utils import EntryNotFoundError
2728

2829
from ..quantizers.quantization_config import QuantizationMethod
@@ -128,7 +129,7 @@ def _fetch_remapped_cls_from_config(config, old_class):
128129
return old_class
129130

130131

131-
def load_state_dict(checkpoint_file: Union[str, os.PathLike], variant: Optional[str] = None, dduf_entries=None):
132+
def load_state_dict(checkpoint_file: Union[str, os.PathLike], variant: Optional[str] = None, dduf_entries: Optional[Dict[str, DDUFEntry]]=None):
132133
"""
133134
Reads a checkpoint file, returning properly formatted errors if they arise.
134135
"""

src/diffusers/pipelines/pipeline_loading_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from typing import Any, Callable, Dict, List, Optional, Union
2121

2222
import torch
23-
from huggingface_hub import ModelCard, model_info
23+
from huggingface_hub import DDUFEntry, ModelCard, model_info
2424
from huggingface_hub.utils import validate_hf_hub_args
2525
from packaging import version
2626

@@ -626,7 +626,7 @@ def load_sub_model(
626626
low_cpu_mem_usage: bool,
627627
cached_folder: Union[str, os.PathLike],
628628
use_safetensors: bool,
629-
dduf_entries,
629+
dduf_entries: Optional[Dict[str, DDUFEntry]],
630630
):
631631
"""Helper method to load the module `name` from `library_name` and `class_name`"""
632632

src/diffusers/utils/hub_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from uuid import uuid4
2727

2828
from huggingface_hub import (
29+
DDUFEntry,
2930
ModelCard,
3031
ModelCardData,
3132
create_repo,
@@ -291,7 +292,7 @@ def _get_model_file(
291292
user_agent: Optional[Union[Dict, str]] = None,
292293
revision: Optional[str] = None,
293294
commit_hash: Optional[str] = None,
294-
dduf_entries=None,
295+
dduf_entries: Optional[Dict[str, DDUFEntry]]=None,
295296
):
296297
pretrained_model_name_or_path = str(pretrained_model_name_or_path)
297298

0 commit comments

Comments
 (0)