나는 Stanford-NER로 사용자 지정 NER 모델을 교육했습니다. 속성 파일을 만들고 java 명령에 -serverProperties
인수를 사용하여 서버를 시작한 다음 (내 다른 질문 (예 : here 참조)) 사용자 정의 NER 모델 을로드하지만 서버가 내 사용자 정의를로드하려고 시도 할 때을로드합니다. java.io.EOFException: Unexpected end of ZLIB input stream
은 다음NER 분류기로드 중 오류 - ZLIB 입력 스트림의 예상치 못한 끝
오류가있는 stderr.log
출력 될 때 : 내가 2007-에서 자바 문제에 관해서입니다 읽은 내용의 오류 대부분을 검색 좀
[main] INFO CoreNLP - --- StanfordCoreNLPServer#main() called ---
[main] INFO CoreNLP - setting default constituency parser
[main] INFO CoreNLP - warning: cannot find edu/stanford/nlp/models/srparser/englishSR.ser.gz
[main] INFO CoreNLP - using: edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz instead
[main] INFO CoreNLP - to use shift reduce parser download English models jar from:
[main] INFO CoreNLP - http://stanfordnlp.github.io/CoreNLP/download.html
[main] INFO CoreNLP - Threads: 4
[main] INFO CoreNLP - Liveness server started at /0.0.0.0:9000
[main] INFO CoreNLP - Starting server...
[main] INFO CoreNLP - StanfordCoreNLPServer listening at /0.0.0.0:80
[pool-1-thread-3] INFO CoreNLP - [/127.0.0.1:35546] API call w/annotators tokenize,ssplit,pos,lemma,depparse,natlog,ner,openie
[pool-1-thread-3] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator tokenize
[pool-1-thread-3] INFO edu.stanford.nlp.pipeline.TokenizerAnnotator - No tokenizer type provided. Defaulting to PTBTokenizer.
[pool-1-thread-3] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ssplit
[pool-1-thread-3] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator pos
[pool-1-thread-3] INFO edu.stanford.nlp.tagger.maxent.MaxentTagger - Loading POS tagger from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0.7 sec].
[pool-1-thread-3] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator lemma
[pool-1-thread-3] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator depparse
[pool-1-thread-3] INFO edu.stanford.nlp.parser.nndep.DependencyParser - Loading depparse model file: edu/stanford/nlp/models/parser/nndep/english_UD.gz ... [pool-1-thread-3] INFO edu.stanford.nlp.parser.nndep.Classifier - PreComputed 99996, Elapsed Time: 12.297 (s)
[pool-1-thread-3] INFO edu.stanford.nlp.parser.nndep.DependencyParser - Initializing dependency parser ... done [13.6 sec].
[pool-1-thread-3] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator natlog
[pool-1-thread-3] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ner
java.io.EOFException: Unexpected end of ZLIB input stream
at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:240
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:117)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2620)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2636)
at java.io.ObjectInputStream$BlockDataInputStream.readDoubles(ObjectInputStream.java:3333)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1920)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1529)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1933)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1529)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
at edu.stanford.nlp.ie.crf.CRFClassifier.loadClassifier(CRFClassifier.java:2650)
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(AbstractSequenceClassifier.java:1462)
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(AbstractSequenceClassifier.java:1494)
at edu.stanford.nlp.ie.crf.CRFClassifier.getClassifier(CRFClassifier.java:2963)
at edu.stanford.nlp.ie.ClassifierCombiner.loadClassifierFromPath(ClassifierCombiner.java:282)
at edu.stanford.nlp.ie.ClassifierCombiner.loadClassifiers(ClassifierCombiner.java:266)
at edu.stanford.nlp.ie.ClassifierCombiner.<init>(ClassifierCombiner.java:141)
at edu.stanford.nlp.ie.NERClassifierCombiner.<init>(NERClassifierCombiner.java:128)
at edu.stanford.nlp.pipeline.AnnotatorImplementations.ner(AnnotatorImplementations.java:121)
at edu.stanford.nlp.pipeline.AnnotatorFactories$6.create(AnnotatorFactories.java:273)
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:152)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:451)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:154)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:145)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.mkStanfordCoreNLP(StanfordCoreNLPServer.java:273)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.access$500(StanfordCoreNLPServer.java:50)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$CoreNLPHandler.handle(StanfordCoreNLPServer.java:583)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
모델은이 오류와 함께 실패 2010 년 EOFException이 "a 우습게 "던져 버렸다. 이 정보는 here입니다.
"는 EOFException는이 일관성이 발생합니다 일부 파일 ((Deflater.BEST_COMPRESSION, TRUE) 새로운 디플렉터를 통해)은 gzip을 사용하고 파일이 올바른 있지만 예외 : EOFException가. 팽창의 끝에서 발생하는 경우, 버그가 있습니다 일부 파일은 던져지고 다른 파일은 그렇지 않습니다. "
이 오류 상태와 관련하여 다른 사람들의 질문에 대답하면 gzip의 출력 스트림을 닫아야합니다 ...? 이것이 의미하는 바가 무엇인지 모를 때 Stanford-NER가 gzip 파일을 만드는 소프트웨어라는 점에서 그 충고를 어떻게 실행해야할지 모르겠다.
질문 :이 오류를 제거하기 위해 취할 수있는 조치는 무엇입니까? 나는 이것이 과거에 다른 사람들에게 일어 났길 바란다. 또한 @StanfordNLPHelp로부터 과거에 제기 된 유사한 문제가 있었는지 및이 문제를 해결하기 위해 CoreNLP 소프트웨어에 수행 된 작업/무언가가 있는지 여부에 대한 피드백을 찾고 있습니다. CoreNLP의 솔루션이 있다면 변경해야하는 파일, CoreNLP 프레임 워크 내에있는 파일의 위치 및 변경해야 할 사항은 무엇입니까?
ADDED 정보 (PER @StanfordNLPHelp 코멘트) :
내 모델은 방향을 사용하여 훈련되었다 here을 발견했다. 모델을 교육하기 위해 나는 약 90 건의 문서의 텍스트가 포함 된 지시 사항에 설명 된대로 TSV를 사용했습니다. 이것은 훈련 할 상당한 양의 데이터가 아니라는 것을 알지만 테스트 단계에 있으며 더 많은 데이터를 수집 할 때 모델을 개선 할 것입니다.
이 TSV 파일과 Standford-NER 소프트웨어를 사용하여 아래 명령을 실행했습니다.
java -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop austen.prop
그때 나는 내 모델을 구축 있었다 심지어로드하고 성공적으로 스탠포드 NER 소프트웨어와 함께 제공되는 NER의 GUI와 텍스트의 큰 신체에 태그를 할 수 있었다.
왜 모델을 작동시키지 못했는지 문제가 발생하는 동안 CoreNLP에서 표준으로 제공되는 "3 클래스 모델"에 대한 파일 경로로 server.properties 파일을 업데이트하려고 시도했습니다. 다시 같은 오류로 실패했습니다.
내 사용자 지정 모델과 3 클래스 모델이 둘 다 Stanford-NER 소프트웨어에서 작동하지만로드하지 못하면 내 사용자 지정 모델이 문제가 아니며 CoreNLP 소프트웨어가로드되는 방식에 문제가 있다는 것을 알 수 있습니다 이 모델들은 -serverProperties
인수를 통해 나타납니다. 아니면 내가 모르는 뭔가 일 수 있습니다.
NER 모델을 학습하는 데 사용한 속성 파일은 열차 파일이 변경된 방향의 켜기 기능과 유사하고 출력 파일 이름이 변경되었습니다. 그것은 다음과 같습니다
# location of the training file
trainFile = custom-model-trainingfile.tsv
# location where you would like to save (serialize) your
# classifier; adding .gz at the end automatically gzips the file,
# making it smaller, and faster to load
serializeTo = custome-ner-model.ser.gz
# structure of your training file; this tells the classifier that
# the word is in column 0 and the correct answer is in column 1
map = word=0,answer=1
# This specifies the order of the CRF: order 1 means that features
# apply at most to a class pair of previous class and current class
# or current class and next class.
maxLeft=1
# these are the features we'd like to train with
# some are discussed below, the rest can be
# understood by looking at NERFeatureFactory
useClassFeature=true
useWord=true
# word character ngrams will be included up to length 6 as prefixes
# and suffixes only
useNGrams=true
noMidNGrams=true
maxNGramLeng=6
usePrev=true
useNext=true
useDisjunctive=true
useSequences=true
usePrevSequences=true
# the last 4 properties deal with word shape features
useTypeSeqs=true
useTypeSeqs2=true
useTypeySequences=true
wordShape=chris2useLC
내 server.properties 파일 나는 또한 시작 스크립트는 $ CLASSPATH 변수에 /path/to/custom_model
을 추가 한 줄 ner.model = /path/to/custom_model.ser.gz
가 포함되어 있습니다. 라인 CLASSPATH="$CLASSPATH:$JAR
을 CLASSPATH="$CLASSPATH:$JAR:/path/to/custom_model.ser.gz
으로 변경했습니다. 내가 ZLIB 오류 메시지가 처음으로 표시되기 때문에 이것이 필요한 단계인지 확실하지 않습니다. 완전성을 위해 이것을 포함하고 싶었습니다.
gunzip custom_model.ser.gz
명령으로 내 사용자 정의 모델을 "gunzip"하려고 시도했지만 모델을로드하려고 할 때와 유사한 오류가 발생했습니다. 그것입니다 gzip: custom_model.ser.gz: unexpected end of file
@ChristopherManning 분명히 CoreNLP에 대해 꽤 많이 알고 있고 오류 관련 질문에 대답하는 경향이 있습니다. 전에 본 적 있어요? –
실제로 훈련 된 모델을 실제로 성공적으로 실행 한 적이 있습니까? 새 ner 모델을 어떻게 훈련했는지에 대한 세부 정보를 제공 할 수 있습니까? 예를 들어 명령 및 특성 파일이 사용 되었습니까? 이런 오류가 발생하면 훈련 된 모델 파일 자체에 문제가 있다고 생각하게됩니다. – StanfordNLPHelp
또한 명령 줄에서 파일을 gunzip'ing 했습니까? 나는 파일이 gzip으로 작동해야한다고 생각하지 않는다. 따라서 gzip으로 압축되지 않은 버전을로드하려고 시도 할 수 있습니다. – StanfordNLPHelp