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. These operate on one or more models, and 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 that 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. For example: $VAR{model_id} or $model_id.

  2. $TASK_OUTPUT{<task-name>:<task-type>}: output path of a previous task. For example: $TASK_OUTPUT{myname:compile}.

CLI Usage

The basic command is as follows:

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.

Refer to the CLI Reference for LEIP Pipeline for a detailed explanation of each option.

Here is a JSON schema that you can use to validate your configurations regardless of whether they are in JSON or YAML format:

pipeline_schema.json

We have provided several YAML configurations for you to download if you choose to use YAML for your configuration file:

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.