Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/diffusers/modular_pipelines/modular_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ class ModularPipelineBlocks(ConfigMixin, PushToHubMixin):
"""

config_name = "config.json"
model_name = None

@classmethod
def _get_signature_keys(cls, obj):
Expand All @@ -333,6 +334,14 @@ def _get_signature_keys(cls, obj):

return expected_modules, optional_parameters

@property
def expected_components(self) -> List[ComponentSpec]:
return []

@property
def expected_configs(self) -> List[ConfigSpec]:
return []

@classmethod
def from_pretrained(
cls,
Expand All @@ -358,7 +367,9 @@ def from_pretrained(
trust_remote_code, pretrained_model_name_or_path, has_remote_code
)
if not (has_remote_code and trust_remote_code):
raise ValueError("TODO")
raise ValueError(
"Selected model repository does not happear to have any custom code or does not have a valid `config.json` file."
)

class_ref = config["auto_map"][cls.__name__]
module_file, class_name = class_ref.split(".")
Expand All @@ -367,7 +378,6 @@ def from_pretrained(
pretrained_model_name_or_path,
module_file=module_file,
class_name=class_name,
is_modular=True,
**hub_kwargs,
**kwargs,
)
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/modular_pipelines/modular_pipeline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ComponentSpec:
config: Optional[FrozenDict] = None
# YiYi Notes: should we change it to pretrained_model_name_or_path for consistency? a bit long for a field name
repo: Optional[Union[str, List[str]]] = field(default=None, metadata={"loading": True})
subfolder: Optional[str] = field(default=None, metadata={"loading": True})
subfolder: Optional[str] = field(default="", metadata={"loading": True})
variant: Optional[str] = field(default=None, metadata={"loading": True})
revision: Optional[str] = field(default=None, metadata={"loading": True})
default_creation_method: Literal["from_config", "from_pretrained"] = "from_pretrained"
Expand Down