loadModel method
Future<bool>
loadModel({
- required String modelPath,
- int contextLength = 4096,
- int threads = 0,
- int? threadsBatch,
- int? batchSize,
- int gpuLayers = 0,
- bool preferPerformanceCores = true,
- int? maxModelBytes,
- double temperature = 0.7,
- int topK = 40,
- double topP = 0.95,
- double? minP,
- double? typicalP,
- double? topNSigma,
- int? mirostatType,
- double? mirostatTau,
- double? mirostatEta,
- double? repeatPenalty,
- double? frequencyPenalty,
- double? presencePenalty,
- int? repeatLastN,
- int? minKeep,
override
Implementation
@override
Future<bool> loadModel({
required String modelPath,
int contextLength = 4096,
int threads = 0,
int? threadsBatch,
int? batchSize,
int gpuLayers = 0,
bool preferPerformanceCores = true,
int? maxModelBytes,
double temperature = 0.7,
int topK = 40,
double topP = 0.95,
double? minP,
double? typicalP,
double? topNSigma,
int? mirostatType,
double? mirostatTau,
double? mirostatEta,
double? repeatPenalty,
double? frequencyPenalty,
double? presencePenalty,
int? repeatLastN,
int? minKeep,
}) async {
if (kDebugMode) {
// ignore: avoid_print
print('[MaathaiLlamma] loadModel(path=$modelPath, ctx=$contextLength, threads=$threads, threadsBatch=${threadsBatch ?? 0}, batchSize=${batchSize ?? 0}, gpuLayers=$gpuLayers, preferPerformanceCores=$preferPerformanceCores, maxModelBytes=${maxModelBytes ?? -1})');
}
final loaded = await methodChannel.invokeMethod<bool>('loadModel', {
'modelPath': modelPath,
'contextLength': contextLength,
'threads': threads,
'threadsBatch': threadsBatch,
'batchSize': batchSize,
'gpuLayers': gpuLayers,
'preferPerformanceCores': preferPerformanceCores,
'maxModelBytes': maxModelBytes,
'temperature': temperature,
'topK': topK,
'topP': topP,
'minP': minP,
'typicalP': typicalP,
'topNSigma': topNSigma,
'mirostatType': mirostatType,
'mirostatTau': mirostatTau,
'mirostatEta': mirostatEta,
'repeatPenalty': repeatPenalty,
'frequencyPenalty': frequencyPenalty,
'presencePenalty': presencePenalty,
'repeatLastN': repeatLastN,
'minKeep': minKeep,
});
if (kDebugMode) {
// ignore: avoid_print
print('[MaathaiLlamma] loadModel -> ${loaded ?? false}');
}
return loaded ?? false;
}