mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
fix:加载模型到内存时内存泄露bug (#1465)
* fix existSegment bug which embedding search not has min-score,so that it will return true.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,5 +108,4 @@ public class TimeCorrector extends BaseSemanticCorrector {
|
||||
semanticParseInfo.getSqlInfo().setCorrectedS2SQL(correctS2SQL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user