Skip to content

Commit

Permalink
Make pipeline argument positional and relative to cwd (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeSneyders authored Jun 23, 2023
1 parent 830d6b0 commit a711541
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
12 changes: 1 addition & 11 deletions examples/pipelines/controlnet-interior-design/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
"""Pipeline used to create a stable diffusion dataset from a set of initial prompts."""
# pylint: disable=import-error
import argparse
import logging
import sys

sys.path.append("../")

from pipeline_configs import PipelineConfigs

from fondant.pipeline import (
ComponentOp,
Pipeline,
Client,
)
from fondant.pipeline import ComponentOp, Pipeline

logger = logging.getLogger(__name__)
# General configs
pipeline_name = "controlnet-pipeline"
pipeline_description = "Pipeline that collects data to train ControlNet"

client = Client(host=PipelineConfigs.HOST)

# Define component ops
generate_prompts_op = ComponentOp(
component_spec_path="components/generate_prompts/fondant_component.yaml",
Expand Down Expand Up @@ -83,5 +75,3 @@
pipeline.add_op(caption_images_op, dependencies=download_images_op)
pipeline.add_op(segment_images_op, dependencies=caption_images_op)
pipeline.add_op(write_to_hub_controlnet, dependencies=segment_images_op)

client.compile_and_run(pipeline=pipeline)
7 changes: 1 addition & 6 deletions examples/pipelines/finetune_stable_diffusion/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
"""Pipeline used to create a stable diffusion dataset from a set of given images."""
import argparse
import logging
import sys

sys.path.append("../")

from pipeline_configs import PipelineConfigs

from fondant.pipeline import ComponentOp, Pipeline, Client
from fondant.pipeline import ComponentOp, Pipeline

logger = logging.getLogger(__name__)
# General configs
pipeline_name = "Test fondant pipeline"
pipeline_description = "A test pipeline"

client = Client(host=PipelineConfigs.HOST)

load_component_column_mapping = {"image": "images_data", "text": "captions_data"}

write_component_column_mapping = {
Expand Down Expand Up @@ -97,5 +94,3 @@
pipeline.add_op(download_images_op, dependencies=laion_retrieval_op)
pipeline.add_op(caption_images_op, dependencies=download_images_op)
pipeline.add_op(write_to_hub, dependencies=caption_images_op)

client.compile_and_run(pipeline=pipeline)
6 changes: 3 additions & 3 deletions fondant/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import importlib
import logging
import shutil
import sys
import typing as t

from fondant.compiler import DockerCompiler
Expand All @@ -34,6 +35,7 @@


def entrypoint():
sys.path.append(".")
args = cli.parse_args()
args.func(args)

Expand Down Expand Up @@ -168,10 +170,8 @@ def pipeline_from_string(import_string: str) -> Pipeline:
help="Compile a fondant pipeline",
args=[
argument(
"--pipeline",
"-p",
"pipeline",
help="Path to the fondant pipeline: path.to.module:instance",
required=True,
type=pipeline_from_string,
),
argument(
Expand Down

0 comments on commit a711541

Please sign in to comment.