Action Builder#
-
class ActionBuilder#
Builder class for action expert TensorRT engines. Handles the complete process of building TensorRT engines from ONNX models for action experts used in multimodal models (e.g., Alpamayo 1).
Public Functions
- ActionBuilder(
- std::filesystem::path const &onnxDir,
- std::filesystem::path const &engineDir,
- ActionBuilderConfig const &config
Constructor for ActionBuilder.
- Parameters:
onnxDir – Directory containing the ONNX model and configuration files
engineDir – Directory where the built engine and related files will be saved
config – Configuration object specifying build parameters
-
~ActionBuilder() noexcept = default#
Destructor.
-
bool build()#
Build the TensorRT engine from the action expert ONNX. This method performs the complete build process including:
Loading and parsing the ONNX model
Setting up optimization profiles
Building the TensorRT engine
Copying necessary files to the engine directory
- Returns:
true if build was successful, false otherwise
-
struct ActionBuilderConfig#
Configuration structure for action expert model building. Contains parameters needed to build the TensorRT engine from the action expert ONNX (e.g. Alpamayo 1 flow-matching decoder).
Public Functions
-
inline Json toJson() const#
Convert configuration to JSON format for serialization.
- Returns:
JSON object containing all configuration parameters
-
inline std::string toString() const#
Convert configuration to human-readable string format.
- Returns:
String representation of the configuration for debugging/logging
Public Members
-
int32_t minSeqLen = {2808}#
Minimum sequence length for dynamic dimensions (e.g. seq_length, past_kv sequence dim). Must match the range used when exporting the action ONNX (e.g. 2808 for Alpamayo).
-
int32_t maxSeqLen = {3424}#
Maximum sequence length for dynamic dimensions. Must match the export range (e.g. 3424 for Alpamayo).
-
int32_t optSeqLen = {(2808 + 3424) / 2}#
Optimal sequence length for TensorRT to optimize for. When loading from JSON, if omitted, defaults to (minSeqLen + maxSeqLen) / 2 in fromJson().
Public Static Functions
-
static inline ActionBuilderConfig fromJson(Json const &json)#
Create configuration from JSON format. If opt_seq_len is omitted, sets optSeqLen to (minSeqLen + maxSeqLen) / 2.
- Parameters:
json – JSON object containing configuration parameters
- Returns:
ActionBuilderConfig object with parsed parameters
-
inline Json toJson() const#