diff --git a/examples/pipelines/controlnet-interior-design/pipeline.py b/examples/pipelines/controlnet-interior-design/pipeline.py index 355a1ffc6..d5b7fdc28 100644 --- a/examples/pipelines/controlnet-interior-design/pipeline.py +++ b/examples/pipelines/controlnet-interior-design/pipeline.py @@ -64,8 +64,7 @@ node_pool_name="model-inference-pool", ) -write_to_hub_controlnet = ComponentOp.from_registry( - name="write_to_hf_hub", +write_to_hub_controlnet = ComponentOp( component_spec_path="components/write_to_hub_controlnet/fondant_component.yaml", arguments={ "username": "test-user", diff --git a/fondant/pipeline.py b/fondant/pipeline.py index c1b5a8899..403d7b00e 100644 --- a/fondant/pipeline.py +++ b/fondant/pipeline.py @@ -83,9 +83,8 @@ def extend_arguments(self): @classmethod def from_registry( cls, - name: str, + name: t.Optional[str] = None, *, - component_spec_path: t.Optional[t.Union[str, Path]] = None, arguments: t.Optional[t.Dict[str, t.Any]] = None, number_of_gpus: t.Optional[int] = None, node_pool_name: t.Optional[str] = None, @@ -95,12 +94,10 @@ def from_registry( """Load a reusable component by its name. Args: - name: Name of the component to load - component_spec_path: The path to the specification file defining the component, defaults - to path defined within the component but can be specified to define custom - specification file + name: Name of the reusable component to load. Should be one of the folder names present + here: https://github.com/ml6team/fondant/tree/main/components). arguments: A dictionary containing the argument name and value for the operation. - number_of_gpus: The number of gpus to assign to the operation + number_of_gpus: The number of gpus to assign to the operation. node_pool_name: The name of the node pool to which the operation will be assigned. p_volumes: Collection of persistent volumes in a Kubernetes cluster. Keys are mount paths, values are Kubernetes volumes or inherited types(e.g. PipelineVolumes). @@ -108,14 +105,13 @@ def from_registry( Defined by string which can be a number or a number followed by one of “E”, “P”, “T”, “G”, “M”, “K”. (e.g. 2T for 2 Terabytes) """ - if not component_spec_path: - component_spec_path = ( - files("fondant") / f"components/{name}/fondant_component.yaml" # type: ignore - ) - component_spec_path = t.cast(Path, component_spec_path) + component_spec_path = ( + files("fondant") / f"components/{name}/fondant_component.yaml" # type: ignore + ) + component_spec_path = t.cast(Path, component_spec_path) - if not (component_spec_path.exists() and component_spec_path.is_file()): - raise ValueError(f"No reusable component with name {name} found.") + if not (component_spec_path.exists() and component_spec_path.is_file()): + raise ValueError(f"No reusable component with name {name} found.") return ComponentOp( component_spec_path,