Open EddieChan1993 opened 1 year ago
You can refer to the code example below from golinear
// Load a previously saved model.
func LoadModel(filename string) (*Model, error) {
cFilename := C.CString(filename)
defer C.free(unsafe.Pointer(cFilename))
model := &Model{C.load_model_wrap(cFilename), nil, nil}
if model.model == nil {
return nil, errors.New("Cannot read model: " + filename)
}
runtime.SetFinalizer(model, finalizeModel)
return model, nil
}
library's performance can be optimized. Currently, its design of directly opening model or training set files leads to a significant time cost in the preparation stage, because typically, both types of files are large in size.