setLoraWeightsPath method
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.');
}
// Create updated spec with new LoRA path
late ModelSpec updatedSpec;
if (_currentActiveModel is InferenceModelSpec) {
final current = _currentActiveModel as InferenceModelSpec;
updatedSpec = InferenceModelSpec(
name: current.name,
modelUrl: current.modelUrl,
loraUrl: path.startsWith('/') ? 'file://$path' : path,
replacePolicy: current.replacePolicy,
);
} else {
throw Exception('LoRA weights can only be applied to inference models');
}
await _ensureModelReadySpec(updatedSpec);
_currentActiveModel = updatedSpec;
}