installModelFromAsset method

  1. @override
Future<void> installModelFromAsset(
  1. String path, {
  2. String? loraPath,
})
override

Installs the model and lora weights from the asset.

Model should be loaded before initialization.

This method can be safely called multiple times. Model and lora weights will be loaded only if they doesn't exist.

To reload the model, call deleteModel first. To reload the lora weights, call deleteLoraWeights first.

This method should be used only for development purpose. Never embed neither model nor lora weights in the production app.

Implementation

@override
Future<void> installModelFromAsset(String path, {String? loraPath}) async {
  if (kReleaseMode) {
    throw UnsupportedError(
        "Method loadAssetModelWithProgress should not be used in the release build");
  }
  await _loadModel(
      'assets/$path', loraPath != null ? 'assets/$loraPath' : null);
}