Skip to content

Commit b9e9965

Browse files
authored
[Modular] Updates for Custom Pipeline Blocks (#11940)
* update * update * update
1 parent 478df93 commit b9e9965

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/diffusers/modular_pipelines/modular_pipeline.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ class ModularPipelineBlocks(ConfigMixin, PushToHubMixin):
323323
"""
324324

325325
config_name = "config.json"
326+
model_name = None
326327

327328
@classmethod
328329
def _get_signature_keys(cls, obj):
@@ -333,6 +334,14 @@ def _get_signature_keys(cls, obj):
333334

334335
return expected_modules, optional_parameters
335336

337+
@property
338+
def expected_components(self) -> List[ComponentSpec]:
339+
return []
340+
341+
@property
342+
def expected_configs(self) -> List[ConfigSpec]:
343+
return []
344+
336345
@classmethod
337346
def from_pretrained(
338347
cls,
@@ -358,7 +367,9 @@ def from_pretrained(
358367
trust_remote_code, pretrained_model_name_or_path, has_remote_code
359368
)
360369
if not (has_remote_code and trust_remote_code):
361-
raise ValueError("TODO")
370+
raise ValueError(
371+
"Selected model repository does not happear to have any custom code or does not have a valid `config.json` file."
372+
)
362373

363374
class_ref = config["auto_map"][cls.__name__]
364375
module_file, class_name = class_ref.split(".")
@@ -367,7 +378,6 @@ def from_pretrained(
367378
pretrained_model_name_or_path,
368379
module_file=module_file,
369380
class_name=class_name,
370-
is_modular=True,
371381
**hub_kwargs,
372382
**kwargs,
373383
)

src/diffusers/modular_pipelines/modular_pipeline_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ComponentSpec:
9393
config: Optional[FrozenDict] = None
9494
# YiYi Notes: should we change it to pretrained_model_name_or_path for consistency? a bit long for a field name
9595
repo: Optional[Union[str, List[str]]] = field(default=None, metadata={"loading": True})
96-
subfolder: Optional[str] = field(default=None, metadata={"loading": True})
96+
subfolder: Optional[str] = field(default="", metadata={"loading": True})
9797
variant: Optional[str] = field(default=None, metadata={"loading": True})
9898
revision: Optional[str] = field(default=None, metadata={"loading": True})
9999
default_creation_method: Literal["from_config", "from_pretrained"] = "from_pretrained"

0 commit comments

Comments
 (0)