mirror of
https://github.com/huggingface/diffusers.git
synced 2026-01-27 17:22:53 +03:00
handle modern types.
This commit is contained in:
@@ -19,6 +19,7 @@ import inspect
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import types
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, List, Union, get_args, get_origin
|
||||
@@ -1823,6 +1824,9 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
|
||||
signature_types[k] = (v.annotation,)
|
||||
elif get_origin(v.annotation) == Union:
|
||||
signature_types[k] = get_args(v.annotation)
|
||||
elif isinstance(v.annotation, types.UnionType):
|
||||
# Handle PEP 604 union syntax (X | Y) introduced in Python 3.10+
|
||||
signature_types[k] = get_args(v.annotation)
|
||||
elif get_origin(v.annotation) in [List, Dict, list, dict]:
|
||||
signature_types[k] = (v.annotation,)
|
||||
else:
|
||||
|
||||
@@ -18,18 +18,9 @@ import unittest
|
||||
import torch
|
||||
from transformers import AutoTokenizer, T5EncoderModel
|
||||
|
||||
from diffusers import (
|
||||
AutoencoderKLWan,
|
||||
FlowMatchEulerDiscreteScheduler,
|
||||
WanPipeline,
|
||||
WanTransformer3DModel,
|
||||
)
|
||||
from diffusers import AutoencoderKLWan, FlowMatchEulerDiscreteScheduler, WanPipeline, WanTransformer3DModel
|
||||
|
||||
from ..testing_utils import (
|
||||
floats_tensor,
|
||||
require_peft_backend,
|
||||
skip_mps,
|
||||
)
|
||||
from ..testing_utils import floats_tensor, require_peft_backend, skip_mps
|
||||
|
||||
|
||||
sys.path.append(".")
|
||||
|
||||
Reference in New Issue
Block a user