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 (_currentActiveModel == null) {
    throw Exception('No active model to apply LoRA weights to. Use setModelPath first.');
  }

  _loraPath = path;

  final updatedSpec = InferenceModelSpec(
    name: _currentActiveModel!.name,
    modelUrl: _currentActiveModel!.modelUrl,
    loraUrl: path.startsWith('http') ? path : 'file://$path',
    replacePolicy: _currentActiveModel!.replacePolicy,
  );

  // Update internal state
  _loraPaths[updatedSpec.name] = path;
  _currentActiveModel = updatedSpec;
}