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.');
  }

  final current = _activeInferenceModel as InferenceModelSpec;

  // Create LoRA source from path
  final loraSource = path.startsWith('http')
      ? ModelSource.network(path)
      : ModelSource.file(path);

  final updatedSpec = InferenceModelSpec(
    name: current.name,
    modelSource: current.modelSource,
    loraSource: loraSource,
    replacePolicy: current.replacePolicy,
  );

  // Update active model (no manual _loraPaths management needed)
  setActiveModel(updatedSpec);
}