API ReferenceiOS
ZeticMLangeModel
API reference for general model inference on iOS.
This page reflects ZeticMLange iOS 1.9.0.
ZeticMLangeModel loads a general on-device model from the Melange registry and runs tensor inference on iOS.
Import
import ZeticMLangeInitializer
public init(
personalKey: String,
name: String,
version: Int? = nil,
modelMode: ModelMode = .RUN_AUTO,
quantType: QuantType? = nil,
cacheHandlingPolicy: ModelCacheHandlingPolicy = .REMOVE_OVERLAPPING,
onDownload: ((Float) -> Void)? = nil
) async throws| Parameter | Type | Default | Description |
|---|---|---|---|
personalKey | String | - | Personal key for accessing the model. |
name | String | - | Model name in account_name/project_name format. |
version | Int? | nil | Model version. nil loads the latest version. |
modelMode | ModelMode | .RUN_AUTO | Backend selection strategy. |
quantType | QuantType? | nil | Optional precision filter. |
cacheHandlingPolicy | ModelCacheHandlingPolicy | .REMOVE_OVERLAPPING | Managed artifact cache cleanup policy. |
onDownload | ((Float) -> Void)? | nil | Download progress callback from 0.0 to 1.0. |
let model = try await ZeticMLangeModel(
personalKey: PERSONAL_KEY,
name: "account_name/project_name"
)run(inputs:)
Runs inference with tensors matching the model input order.
public func run(inputs: [Tensor]) throws -> [Tensor]| Parameter | Type | Description |
|---|---|---|
inputs | [Tensor] | Input tensors matching the model's expected shapes and data types. |
Returns: output tensors in model output order.
let outputs = try model.run(inputs: [inputTensor])
let firstOutput = outputs[0]Lifecycle
public private(set) var isClosed: Bool
public func close()Call close() when the model is no longer needed.
model.close()