aclmdlLoadWithConfig

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Function Usage

Loads a model based on the given configuration. Before loading a model file, check whether the memory is sufficient based on the file size. If the memory is insufficient, the application will malfunction.

This API needs to work with the following APIs to load models:
  1. Call aclmdlCreateConfigHandle to create a configuration object for loading a model.
  2. (Optional) Call aclmdlSetExternalWeightAddress to configure device memory for storing external weights.
  3. Call aclmdlSetConfigOpt for multiple times to set the value of each attribute in the configuration object.
  4. Call aclmdlLoadWithConfig to specify the configuration information for model loading and load your model.
  5. After the model is successfully loaded, call aclmdlDestroyConfigHandle to destroy the configuration object.

Prototype

1
aclError aclmdlLoadWithConfig(const aclmdlConfigHandle *handle, uint32_t *modelId)

Parameters

Parameter

Input/Output

Description

handle

Input

Pointer to the configuration object for model loading. For details about the type definition, see aclmdlConfigHandle.

Call aclmdlCreateConfigHandle to create an object in advance, which must be consistent with handle output by the aclmdlSetConfigOpt call.

modelId

Output

Pointer to the model ID.

The model ID will be returned after a model is loaded to the system.

Returns

0 on success; else, failure. For details, see aclError.

Reference

For model loading by using aclmdlSetConfigOpt and aclmdlLoadWithConfig, the caller needs to set the attributes in the configuration object passed to the API call to decide how the model will be loaded and who will manage the memory.

By choosing from the following APIs, you can directly determine whether to load a model from a file or from memory and whether the memory is managed by the system or the user: