Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pipeline argument positional and relative to cwd #227

Merged
merged 3 commits into from
Jun 23, 2023
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
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