Skip to content

Commit ca5afae

Browse files
committed
up
1 parent 6c066f0 commit ca5afae

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

src/diffusers/models/transformers/transformer_hunyuanimage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ def attn_processors(self) -> Dict[str, AttentionProcessor]:
754754
# set recursively
755755
processors = {}
756756

757-
def fn_recursive_add_processors(name: str, module: torch.nn.Module, processors: Dict[str, AttentionProcessor]):
757+
def fn_recursive_add_processors(name: str, module: torch.nn.Module, processors: dict[str, AttentionProcessor]):
758758
if hasattr(module, "get_processor"):
759759
processors[f"{name}.processor"] = module.get_processor()
760760

src/diffusers/pipelines/hunyuan_image/pipeline_hunyuanimage.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
1517
import inspect
1618
import re
1719
from typing import Any, Callable, Dict, List, Optional, Union
@@ -99,9 +101,9 @@ def extract_glyph_text(prompt: str):
99101
def retrieve_timesteps(
100102
scheduler,
101103
num_inference_steps: Optional[int] = None,
102-
device: Optional[Union[str, torch.device]] = None,
103-
timesteps: Optional[List[int]] = None,
104-
sigmas: Optional[List[float]] = None,
104+
device: Optional[str | torch.device] = None,
105+
timesteps: Optional[list[int]] = None,
106+
sigmas: Optional[list[float]] = None,
105107
**kwargs,
106108
):
107109
r"""
@@ -116,15 +118,15 @@ def retrieve_timesteps(
116118
must be `None`.
117119
device (`str` or `torch.device`, *optional*):
118120
The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
119-
timesteps (`List[int]`, *optional*):
121+
timesteps (`list[int]`, *optional*):
120122
Custom timesteps used to override the timestep spacing strategy of the scheduler. If `timesteps` is passed,
121123
`num_inference_steps` and `sigmas` must be `None`.
122-
sigmas (`List[float]`, *optional*):
124+
sigmas (`list[float]`, *optional*):
123125
Custom sigmas used to override the timestep spacing strategy of the scheduler. If `sigmas` is passed,
124126
`num_inference_steps` and `timesteps` must be `None`.
125127
126128
Returns:
127-
`Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
129+
`tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
128130
second element is the number of inference steps.
129131
"""
130132
if timesteps is not None and sigmas is not None:

src/diffusers/pipelines/hunyuan_image/pipeline_hunyuanimage_refiner.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
1517
import inspect
1618
from typing import Any, Callable, Dict, List, Optional, Union
1719

@@ -63,9 +65,9 @@
6365
def retrieve_timesteps(
6466
scheduler,
6567
num_inference_steps: Optional[int] = None,
66-
device: Optional[Union[str, torch.device]] = None,
67-
timesteps: Optional[List[int]] = None,
68-
sigmas: Optional[List[float]] = None,
68+
device: Optional[str | torch.device] = None,
69+
timesteps: Optional[list[int]] = None,
70+
sigmas: Optional[list[float]] = None,
6971
**kwargs,
7072
):
7173
r"""
@@ -80,15 +82,15 @@ def retrieve_timesteps(
8082
must be `None`.
8183
device (`str` or `torch.device`, *optional*):
8284
The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
83-
timesteps (`List[int]`, *optional*):
85+
timesteps (`list[int]`, *optional*):
8486
Custom timesteps used to override the timestep spacing strategy of the scheduler. If `timesteps` is passed,
8587
`num_inference_steps` and `sigmas` must be `None`.
86-
sigmas (`List[float]`, *optional*):
88+
sigmas (`list[float]`, *optional*):
8789
Custom sigmas used to override the timestep spacing strategy of the scheduler. If `sigmas` is passed,
8890
`num_inference_steps` and `timesteps` must be `None`.
8991
9092
Returns:
91-
`Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
93+
`tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the
9294
second element is the number of inference steps.
9395
"""
9496
if timesteps is not None and sigmas is not None:

0 commit comments

Comments
 (0)