Skip to main content
Skip table of contents

LEIP Pipeline

LEIP Pipeline is a single command or Python function call, that allows you to execute one or more LEIP tasks sequentially, operating on one or more models, and where the input of each task may be the output of a previous task. The definition of each task and its configuration parameters is provided through a file in YAML or JSON format. This lets you easily group all the configuration of commands that you want to apply to your models, and easily share it with anyone to run.

The configuration file is organized as a list of tasks. Each task defines its input source, options for a model, and options for an operation among OptimizeCompile, PackageEvaluate, Run, and Zoo Download.

Variables in Configuration

Any string value in the configuration of a LEIP Pipeline task may contain variables, which get replaced by a value before executing the task. The types of variables are:
1. $VAR{<var-name>} or $<var-name>: a variable provided as environment variable or in the pipeline call.
Example: $VAR{model_id} or $model_id.
2. $TASK_OUTPUT{<task-name>:<task-type>}: output path of a previous task. Example: $TASK_OUTPUT{myname:compile}.

CLI Usage

The basic command is:

BASH
leip pipeline --input_path inputModel/ \
              --output_path pipelineOutputs/ \
              --config_path config.yaml

Here, the --input_path argument maps to the $VAR{input_path} variable in the configuration.

For a detailed explanation of each option see the CLI Reference for LEIP Pipeline.

If you choose to use JSON for your configuration file, we’ve provided a JSON schema for you to download:

pipeline_schema.json

If you choose to use YAML, we have provided some examples for you to follow:

Example Configurations

Simple task to run a single inference
YAML
name: Inference
tasks:
  - name: simple-inference
    model:
      path: $input_path
    run:
      test_path: test_image.jpg
      class_names: class_names.txt

Evaluating before and after Optimize
YAML
name: Optimize Flow
tasks:
  - name: baseline
    model:
      path: $VAR{input_path}
      preprocessor: imagenet
    evaluate:
      test_path: index.txt
  
  - name: baseline
    model:
      path: $VAR{input_path}
    optimize:
      compress:
        data_type: uint8
        rep_dataset: rep_dataset.txt
  
  - name: optimized
    model:
      path: $TASK_OUTPUT{baseline:optimize}
    evaluate:
      test_path: index.txt

Compiling to several targets
YAML
name: MultiTarget
tasks:
  - name: target-llvm
    model:
      path: $VAR{input_path}
    compile:
      target: llvm
  
  - name: target-cuda
    model:
      path: $VAR{input_path}
    compile:
      target: cuda


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.