java调用LAC失败
siming-sun opened this issue · comments
环境:
paddle 1.8
lac v2.1.0
jdk 1.8
ubuntu
初始化LAC时抛出异常
C [liblacjni.so+0x10a153b] paddle::AnalysisConfig::SerializeInfoCache()+0x1fb
具体的栈信息
Stack: [0x00007f75159b6000,0x00007f7515ab6000], sp=0x00007f7515ab4080, free space=1016k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [liblacjni.so+0x10a153b] paddle::AnalysisConfig::SerializeInfoCache()+0x1fb
C [liblacjni.so+0x10a1e28] paddle::AnalysisConfig::Update()+0x28
C [liblacjni.so+0xec7e54] LAC::LAC(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, CODE_TYPE)+0x724
C 0x0000000000000009
C 0x00007f751000006c
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.baidu.nlp.LAC.init(Ljava/lang/String;)V+0
j com.baidu.nlp.LAC.(Ljava/lang/String;)V+6
j LacDemo.main([Ljava/lang/String;)V+18
v ~StubRoutines::call_stub
code:
import java.util.ArrayList;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import com.baidu.nlp.LAC;
public class LacDemo {
static {
System.load("/home/test/fluid_inference/paddle/lib/libpaddle_fluid.so");
System.load("/home/test/paddleTest/lac/output/java/liblacjni.so");
}
public static void main(String[] args) {
String model_path = "/home/test/paddleTest/lac/output/java/models_general/seg_model";
if (args.length > 0) {
model_path = args[0];
}
LAC lac = new LAC("seg_model");
// 装载用户词典
if (args.length > 1) {
lac.loadCustomization(args[1]);
}
ArrayList<String> words = new ArrayList<>();
ArrayList<String> tags = new ArrayList<>();
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
String query = null;
try {
while ((query = stdin.readLine()) != null) {
lac.run(query, words, tags);
System.out.println(words);
System.out.println(tags);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
~
飞桨使用的是官方提供的编译包、模型使用的是默认模型
环境问题