Error while executing into the colab

#1
by devanghingu - opened

I m getting this error while execute into the colab notebook

 
      3   classifier = pipeline("zero-shot-classification", model="Formzu/roberta-base-japanese-jsnli")
----> 4   sequence_to_classify = " ".join([tok.midasi for tok in jumanpp.analysis("いつか世界を見る。").mrph_list()])
      5   candidate_labels = topics
      6   out = classifier(sequence_to_classify, candidate_labels, hypothesis_template="この 例 は {} です 。")

/usr/local/lib/python3.7/dist-packages/pyknp/juman/juman.py in analysis(self, input_str, juman_format)
     96             MList: 形態素列オブジェクト
     97         """
---> 98         return self.juman(input_str, juman_format)
     99 
    100     def result(self, input_str, juman_format=JUMAN_FORMAT.DEFAULT):

/usr/local/lib/python3.7/dist-packages/pyknp/juman/juman.py in juman(self, input_str, juman_format)
     83         """ analysis関数と同じ """
     84         assert isinstance(input_str, six.text_type)
---> 85         result = MList(self.juman_lines(input_str), juman_format)
     86         return result
     87 

/usr/local/lib/python3.7/dist-packages/pyknp/juman/juman.py in juman_lines(self, input_str)
     78             input_str = input_str.replace('\n', '')
     79             print('Analysis is done ignoring "\\n".', file=sys.stderr)
---> 80         return self.analyzer.query(input_str, pattern=self.pattern)
     81 
     82     def juman(self, input_str, juman_format=JUMAN_FORMAT.DEFAULT):

/usr/local/lib/python3.7/dist-packages/pyknp/utils/analyzer.py in query(self, input_str, pattern)
     47             return self.socket.query(input_str, pattern=pattern)
     48         else:
---> 49             return self.subprocess.query(input_str, pattern=pattern)

/usr/local/lib/python3.7/dist-packages/pyknp/utils/process.py in query(self, sentence, pattern)
     77         try:
     78             self.process.stdin.write(sentence.encode('utf-8'))
---> 79             self.process.stdin.flush()
     80             while True:
     81                 line = self.process.stdout.readline().decode('utf-8').rstrip()

BrokenPipeError: [Errno 32] Broken pipe

i installed juman++ as per the requirement and also installed all dependency

Formzu Inc. org

Apparently there is a problem with Juman++ / pyknp libraries.
The following code snippet should produce the following result:

>>> from pyknp import Juman
>>> juman = Juman()
>>> sequence_to_classify = " ".join([tok.midasi for tok in juman.analysis("いつか世界を見る。").mrph_list()])
>>> sequence_to_classify
'いつか 世界 を 見る 。'

Juman++ 2.0.0-rc3 executed from the command line should produce this:

$ echo "いつか世界を見る。" | jumanpp
いつか いつか いつか 副詞 8 * 0 * 0 * 0 "代表表記:何時か/いつか"
世界 せかい 世界 名詞 6 普通名詞 1 * 0 * 0 "代表表記:世界/せかい カテゴリ:場所-その他"
を を を 助詞 9 格助詞 1 * 0 * 0 NIL
見る みる 見る 動詞 2 * 0 母音動詞 1 基本形 2 "代表表記:見る/みる 自他動詞:自:見える/みえる 補文ト"
。 。 。 特殊 1 句点 1 * 0 * 0 NIL
EOS

Hugging Face uses the following code for Juman++ installation:

wget https://github.com/ku-nlp/jumanpp/releases/download/v2.0.0-rc3/jumanpp-2.0.0-rc3.tar.xz
tar xvf jumanpp-2.0.0-rc3.tar.xz
mkdir jumanpp-2.0.0-rc3/bld
cd jumanpp-2.0.0-rc3/bld
sudo cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
sudo make install

Please let me know the versions of Juman++ / pyknp you are using and whether or not you could reproduce these results.

Okay Let me try it out.

Formzu Inc. org

Perhaps this colab also might help.

it worked! i actually installed thorugh different installation mathod
@p-s Thanks you for quick response!

p-s changed discussion status to closed

Sign up or log in to comment