Skip to main content
Skip table of contents

LEIP Pipeline

LEIP Pipeline allows you to execute one or more flows of LEIP commands over one model using a JSON configuration file. This lets you easily group all the configuration of commands that you want to apply to your model, and easily share it with anyone to run.

The configuration file is organized as a set of flows. Each flow defines a sequence of commands from OptimizeCompileEvaluate, and Run. When executed, each flow starts with the same input model and applies each command from the sequence, using as input the last output model from a previous command.

CLI Usage

The basic command is:

JSON
leip pipeline --input_path inputModel/ \
              --output_path flowOutputs/ \
              --config_path config.json

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

You may also download the JSON schema for the configuration file.

Example Configurations

Simple flow to run a single inference
JSON
{
  "flows": [{
    "name": "simple-inference",
    "steps": [{
      "run": {
        "test_path": "test_image.jpg",
        "class_names": "class_names.txt"
      }
    }]
  }]
}

Evaluating before and after Optimize
JSON
{
  "model": {
    "dataset": {
      "preprocessor": "imagenet"
    }
  },
  "flows": [{
    "name": "evaluate-before-and-after",
    "steps": [{
      "evaluate": {
        "test_path": "index.txt",
        "class_names": "class_names.txt"
      }
    }, {
      "optimize": {
        "compress": {
          "data_type": "uint8",
          "rep_dataset": "rep_dataset.txt"
        }
      }
    }, {
      "model": {
        "dataset": {
          "preprocessor": "uint8"
        }
      },
      "evaluate": {
        "test_path": "index.txt",
        "class_names": "class_names.txt"
      }
    }]
  }]
}

Compiling to several targets
JSON
{
  "flows": [{
    "name": "target-llvm",
    "steps": [{
      "compile": {
        "target": "llvm"
      }
    }]
  }, {
    "name": "target-cuda",
    "steps": [{
      "compile": {
        "target": "cuda"
      }
    }]
  }]
}

Simple flow to run a single inference

CODE
{
  "flows": [{
    "name": "simple-inference",
    "steps": [{
      "run": {
        "test_path": "test_image.jpg",
        "class_names": "class_names.txt"
      }
    }]
  }]
}

Evaluating before and after Optimize

JSON
{
  "model": {
    "dataset": {
      "preprocessor": "imagenet"
    }
  },
  "flows": [{
    "name": "evaluate-before-and-after",
    "steps": [{
      "evaluate": {
        "test_path": "index.txt",
        "class_names": "class_names.txt"
      }
    }, {
      "optimize": {
        "compress": {
          "data_type": "uint8",
          "rep_dataset": "rep_dataset.txt"
        }
      }
    }, {
      "model": {
        "dataset": {
          "preprocessor": "uint8"
        }
      },
      "evaluate": {
        "test_path": "index.txt",
        "class_names": "class_names.txt"
      }
    }]
  }]
}

Compiling to several targets

JSON
{
  "flows": [{
    "name": "target-llvm",
    "steps": [{
      "compile": {
        "target": "llvm"
      }
    }]
  }, {
    "name": "target-cuda",
    "steps": [{
      "compile": {
        "target": "cuda"
      }
    }]
  }]
}


JavaScript errors detected

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

If this problem persists, please contact our support.