Skip to content

Commit

Permalink
First draft
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels Rogge authored and Niels Rogge committed Jun 22, 2023
1 parent 3e47ef7 commit 3a78425
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
3 changes: 1 addition & 2 deletions examples/pipelines/controlnet-interior-design/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 10 additions & 14 deletions fondant/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -95,27 +94,24 @@ 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).
ephemeral_storage_size: Used ephemeral-storage request (minimum) for the operation.
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,
Expand Down

0 comments on commit 3a78425

Please sign in to comment.