Skip to content

Commit af9ee87

Browse files
Better error message for transformers dummy (#1306)
1 parent 8a73064 commit af9ee87

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/diffusers/pipeline_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
INDEX_FILE = "diffusion_pytorch_model.bin"
5858
CUSTOM_PIPELINE_FILE_NAME = "pipeline.py"
5959
DUMMY_MODULES_FOLDER = "diffusers.utils"
60+
TRANSFORMERS_DUMMY_MODULES_FOLDER = "transformers.utils"
6061

6162

6263
logger = logging.get_logger(__name__)
@@ -592,7 +593,10 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
592593

593594
if load_method_name is None:
594595
none_module = class_obj.__module__
595-
if none_module.startswith(DUMMY_MODULES_FOLDER) and "dummy" in none_module:
596+
is_dummy_path = none_module.startswith(DUMMY_MODULES_FOLDER) or none_module.startswith(
597+
TRANSFORMERS_DUMMY_MODULES_FOLDER
598+
)
599+
if is_dummy_path and "dummy" in none_module:
596600
# call class_obj for nice error message of missing requirements
597601
class_obj()
598602

0 commit comments

Comments
 (0)