in packages/costa/src/index.ts [209:227]
async runModel(runtime: DefaultRuntime, script: PipcookScript, options: Record<string, any>, taskType = TaskType.TRAIN): Promise<void | PredictResult> {
// log all the requirements are ready to tell the debugger it's going to run.
debug(`start loading the script(${script.name})`);
const entry = await this.importScript<DefaultModelEntry>(script);
// when the `load` is complete, start the plugin.
debug(`loaded the script(${script.name}), start it.`);
const opts = {
...options.train,
...script.query
};
if (taskType === TaskType.TRAIN) {
return entry.train(runtime, opts, { ...this.context, taskType });
} else {
if (!entry.predict) {
throw new TypeError('predict is not supported.');
}
return entry.predict(runtime, opts, { ...this.context, taskType });
}
}