首页 > 解决方案 > 是否可以解决 BrokenPipeError: [Errno 32] Broken pipe in LDA 模型?

问题描述

当我使用 CoherenceModel 时,BrokenPipeError: [Errno 32] Broken pipe 错误发生。特别是在 coherence='c_v' 中,会发生此错误。当我选择参数为“u_ma​​ss”时,不会发生这种情况是否可以解决 BrokenPipeError: [Errno 32] Broken pipe in LDA model?

model = LdaModel(corpus=corpus, id2word=dictionary, num_topics=num_topics) 
model_list.append(model) 
coherencemodel = CoherenceModel(model=model, texts=texts, dictionary=dictionary, coherence='c_v') 
coherence_values.append(coherencemodel.get_coherence()) 

BrokenPipeError                           Traceback (most recent call last)
<ipython-input-8-33bbdf4a0b18> in <module>
     57     logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
     58     # optimize
---> 59     find_optimal_number_of_topics(dictionary, corpus, processed_data)
     60 

<ipython-input-8-33bbdf4a0b18> in find_optimal_number_of_topics(dictionary, corpus, processed_data)
     37     step = 6;
     38 
---> 39     model_list, coherence_values = compute_coherence_values(dictionary=dictionary, corpus=corpus, texts=processed_data, start=start, limit=limit, step=step)
     40     x = range(start, limit, step)
     41     plt.plot(x, coherence_values)

<ipython-input-8-33bbdf4a0b18> in compute_coherence_values(dictionary, corpus, texts, limit, start, step)
     29         model_list.append(model)
     30         coherencemodel = CoherenceModel(model=model, texts=texts, dictionary=dictionary, coherence='c_v')
---> 31         coherence_values.append(coherencemodel.get_coherence())
     32         return model_list, coherence_values
     33 

.........


D:\choi\lib\multiprocessing\context.py in _Popen(process_obj)
    320         def _Popen(process_obj):
    321             from .popen_spawn_win32 import Popen
--> 322             return Popen(process_obj)
    323 
    324     class SpawnContext(BaseContext):

D:\choi\lib\multiprocessing\popen_spawn_win32.py in __init__(self, process_obj)
     87             try:
     88                 reduction.dump(prep_data, to_child)
---> 89                 reduction.dump(process_obj, to_child)
     90             finally:
     91                 set_spawning_popen(None)

D:\choi\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
     58 def dump(obj, file, protocol=None):
     59     '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60     ForkingPickler(file, protocol).dump(obj)
     61 
     62 #

BrokenPipeError: [Errno 32] Broken pipe

标签: pythonpython-3.xgensimtopic-modelingbroken-pipe

解决方案


推荐阅读