Gensim SupportフォーラムでもGoogleでリサーチしましたが、良い答えが見つかりません。Gensimセグメンテーションフォールト
基本的に、私はGensimを使用してDoc2Vecためのオンライン学習を実施していますが、Gensimは私に「セグメンテーション
と呼ばれるランダムなエラーを投げ続けてここに私のサンプルコードで
from gensim.models import Doc2Vec
from gensim.models.doc2vec import LabeledSentence
import random
import logging
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
sentence1 = "this is a test"
sentence2 = "test test 123 test"
sentence3 = "qqq zzz"
sentence4 = "ppp"
sentences = [
LabeledSentence(sentence1.split(), ["p1"]),
LabeledSentence(sentence2.split(), ["p2"])
]
model = Doc2Vec(min_count=1, window=5, size=400, sample=1e-4, negative=5, workers=1)
model.build_vocab(sentences)
for a in range(2):
random.shuffle(sentences)
print([s.tags[0] for s in sentences])
model.train(sentences)
model.save("test.d2v")
new_model = Doc2Vec.load("test.d2v")
new_sentences = [
LabeledSentence(sentence1.split(), ["n1"]),
LabeledSentence(sentence3.split(), ["n2"])
]
new_model.build_vocab(new_sentences, update=True)
for a in range(4):
random.shuffle(new_sentences)
print([s.tags[0] for s in new_sentences])
new_model.train(new_sentences)
を見てみてください、私の誤りであります
INFO:gensim.models.word2vec:training model with 1 workers on 7 vocabulary and 400 features, using sg=0 hs=0 sample=0.0001 negative=5 window=5
INFO:gensim.models.word2vec:expecting 2 sentences, matching count from corpus used for vocabulary survey
Segmentation fault
は、誰も私に説明でき、なぜ?とこの問題を解決する方法?
ありがとう
OS、Python、gensimに問題があるかどうかを知るには?私はPythonでドッカーを使用しています:3画像は、そのコードを実行する(私の質問を参照してください)。 –
これはデバッグが非常に難しいですが、いったん正しい/最新のものを入手すると非常にまれです。 Dockerイメージ内のOS /バージョンは何ですか?新鮮な(またはすべての主要なパッケージをアンインストール/再インストールする)起動は変更を加えましたか? gensimの中でサンプルを実行して、動作するか試してみましたか?これらの手順を踏むことで、問題を絞り込む方法がわかります。 – gojomo