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

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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值