Melange
Model Preparation

Supported Model Formats

Model formats supported by ZETIC Melange: PyTorch, ONNX, and TorchScript.

Melange supports three model formats for on-device deployment. Choose the format that best matches your training framework.

Supported Formats

FormatExtensionStatusRecommended
PyTorch Exported Program.pt2SupportedYes
ONNX.onnxSupportedYes
TorchScript.ptDeprecatedNo

TorchScript (.pt) support will be deprecated soon. We strongly recommend using PyTorch Exported Program (.pt2) or ONNX for future compatibility and better optimization.

Choosing a Format

  • PyTorch users: Use PyTorch Exported Program (.pt2). Requires PyTorch >= 2.1.0.
  • TensorFlow / Keras / scikit-learn users: Convert to ONNX format.
  • Legacy PyTorch projects: TorchScript (.pt) is still supported but will be removed in a future release.

Input Requirements

Regardless of format, all models require:

  1. NumPy input files (.npy): Sample inputs that define the expected tensor shapes and data types.
  2. Fixed input shapes: NPU compilation hard-codes input shapes for maximum throughput. Even if your original model supports dynamic sizes, the Melange-compiled model will accept only the exact shape provided during upload.

NPU compilation hard-codes input shapes to maximize throughput. Even if your original model supports dynamic sizes, the accelerated Melange model will accept only the exact shape of the sample input provided during upload.

Verifying Input Order and Shapes

Melange compiles your model into a static hardware graph. This means consistent input order and input shapes are mandatory for execution.

Why Order Matters

The internal computation graph expects data in specific slots (e.g., input_zero at index 0, input_one at index 1). If you swap them during upload or inference, the model will produce garbage results or crash.

Inspecting with Netron

We recommend using Netron to visualize your model's input signature:

  1. Open your model (.pt2, .onnx, or .pt) in Netron.
  2. Locate the Input Nodes at the top of the graph.
  3. Note the vertical order: the top-most input is Index 0, the next is Index 1, and so on.

You must provide inputs in this exact order when:

  1. Uploading the model via CLI (-i input0.npy -i input1.npy).
  2. Calling the run() function in your Android/iOS app.

Checking input sequence with Netron


Next Steps