Command Line Interface

Qualcomm® AI Hub comes installed with it a command line tool which you can use to do the following:

  • list device information

  • compile models

  • profile models

  • configure the client

The full list of commands, and all their options can be obtained using:

qai-hub --help

And for each command, a full expanded help can be obtained using:

qai-hub submit-profile-job --help

Examples

Here are a few examples of using the CLI for the most popular workflows:

Device selection

# List all devices
qai-hub list-devices

# List all devices with Snapdragon 8 Gen 2
qai-hub list-devices --device-attr chipset:qualcomm-snapdragon-8gen2

Compiling models

# Compile a PyTorch model for |tflite|
qai-hub submit-compile-job --model ./SqueezeNet10.pt --input_specs "{'image': (1, 3, 224, 224)}" --device "Samsung Galaxy S23"

# Compile a PyTorch model for QNN
qai-hub submit-compile-job --model ./SqueezeNet10.pt --input_specs "{'image': (1, 3, 224, 224)}" --device "Samsung Galaxy S23" --compile_options "--target_runtime qnn_lib_aarch64_android"

Profiling models

# Profile a TensorFlow lite model from disk
qai-hub submit-profile-job --model ./SqueezeNet10.tflite --device "Samsung Galaxy S23"

# Profile a model compiled by a previous job using the model ID
qai-hub submit-profile-job --model mejqyvqry --device "Samsung Galaxy S23"

# Profile a model with profiling options
qai-hub submit-profile-job --model mejqyvqry --device "Samsung Galaxy S23" --profile_options " --compute_unit gpu"

Popular combined workflows

# Compile and profile a PyTorch model
qai-hub submit-compile-and-profile-jobs --model ./SqueezeNet10.pt --input_specs "{'image': (1, 3, 224, 224)}" --device "Samsung Galaxy S23"