setLoraWeightsPath method

  1. @override
Future<void> setLoraWeightsPath(
  1. String path
)
override

Sets path to LoRA weights for current model

Implementation

@override
Future<void> setLoraWeightsPath(String path) async {
  await _ensureInitialized();

  if (_activeInferenceModel == null) {
    throw Exception('No active inference model to apply LoRA weights to. Use setModelPath first.');
  }

  // Create updated spec with new LoRA path
  final current = _activeInferenceModel as InferenceModelSpec;
  final updatedSpec = InferenceModelSpec.fromLegacyUrl(
    name: current.name,
    modelUrl: current.modelUrl,
    loraUrl: path.startsWith('/') ? 'file://$path' : path,
    replacePolicy: current.replacePolicy,
  );

  await _ensureModelReadySpec(updatedSpec);
  setActiveModel(updatedSpec);
}