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:

leip pipeline --input_path inputModel/ \
              --output_path flowOutputs/ \
              --config_path config.json
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
{
  "flows": [{
    "name": "simple-inference",
    "steps": [{
      "run": {
        "test_path": "test_image.jpg",
        "class_names": "class_names.txt"
      }
    }]
  }]
}
JSON

Evaluating before and after Optimize
{
  "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"
      }
    }]
  }]
}
JSON

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

Simple flow to run a single inference

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

Evaluating before and after Optimize

{
  "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"
      }
    }]
  }]
}
JSON

Compiling to several targets

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