initLegacy static method
Implementation
@Deprecated('Use download() and init() separately instead')
static Future<CactusLM> initLegacy({
required String modelUrl,
String? modelFilename,
String? chatTemplate,
int contextSize = 2048,
int gpuLayers = 0,
int threads = 4,
bool generateEmbeddings = false,
CactusProgressCallback? onProgress,
String? cactusToken,
}) async {
final lm = CactusLM._();
if (cactusToken != null) {
setCactusToken(cactusToken);
}
final initParams = CactusInitParams(
modelUrl: modelUrl,
modelFilename: modelFilename,
chatTemplate: chatTemplate,
contextSize: contextSize,
gpuLayers: gpuLayers,
threads: threads,
generateEmbeddings: generateEmbeddings,
onInitProgress: onProgress,
);
lm._initParams = initParams;
try {
lm._context = await CactusContext.init(initParams);
} catch (e) {
CactusTelemetry.error(e, initParams);
rethrow;
}
return lm;
}