1. 原因:windows自身的问题。
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.
A PR that clarifies the warning will be very welcome! We should probably only emit that warning when that situation actually happens (chunkize
called with maxsize > 0
on Windows), rather than always on import.
2. 方案 直接忽略该警告即可。在导入gensim 之前,可以使用此代码抑制消息:
import warnings
warnings.filterwarnings(action='ignore',category=UserWarning,module='gensim')
import gensim