UserWarning: detected Windows; aliasing chunkize to chunkize_serial warnings.warn("detected Windows;

使用Word2vec时遇到这个问题怎么办UserWarning: detected Windows; aliasing chunkize to chunkize_serial
warnings.warn("detected Windows; aliasing chunkize to chunkize_serial")?

在加载word2vec前写如下内容忽略警告就可以了
import warnings
warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim')

至于为什么会遇到这种情况,官方给出的解释是这样的:

Some algorithms in Gensim (mostly the distributed/parallelized versions) call a function called chunkize, which splits an input stream of records into batches. It works in a streaming manner (lazy batch iteration). chunkize has an optional parameter that can actively prepare and buffer data batches in advance: not quite lazy, but also not eager (buffers a limited fixed number of batches in advance).

This optional functionality is not available on Windows, because it uses multi-processing and is slower. So on Windows, only chunkize_serial is available (no buffering). It's aliased to chunkize for API compatibility reason.

This is a rather technical point, related to performance on slow I/O input streams on Windows. You can probably ignore it.

你可能感兴趣的:(UserWarning: detected Windows; aliasing chunkize to chunkize_serial warnings.warn("detected Windows;)