fix:加载模型到内存时内存泄露bug (#1465)

* fix existSegment bug which embedding search not has min-score,so that it will return true.
This commit is contained in:
JackLiang
2024-07-26 18:07:49 +08:00
committed by GitHub
parent 85088abd7b
commit 8f620480c6
2 changed files with 5 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ import java.nio.file.Paths;
*/
public class S2OnnxEmbeddingModel extends AbstractInProcessEmbeddingModel {
private final OnnxBertBiEncoder model;
private static OnnxBertBiEncoder model = null;
/**
* @param pathToModel The path to the .onnx model file (e.g., "/home/me/model.onnx").
@@ -33,7 +33,9 @@ public class S2OnnxEmbeddingModel extends AbstractInProcessEmbeddingModel {
throw new RuntimeException(e);
}
}
model = loadFromFileSystem(Paths.get(pathToModel), resource);
if (model == null) {
model = loadFromFileSystem(Paths.get(pathToModel), resource);
}
}
/**

View File

@@ -108,5 +108,4 @@ public class TimeCorrector extends BaseSemanticCorrector {
semanticParseInfo.getSqlInfo().setCorrectedS2SQL(correctS2SQL);
}
}
}
}