使用保存的Word2Vec mod时出现警告

2024-06-09 00:05:59 发布

您现在位置:Python中文网/ 问答频道 /正文

运行此代码时出现此警告

model.save('raw_gutenberg_model.w2v')
model = gensim.models.Word2Vec.load('raw_gutenberg_model.w2v')
model['dog']

错误:

"/home/computer_name/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:1: DeprecationWarning: Call to deprecated `doesnt_match` (Method will be removed in 4.0.0, use self.wv.doesnt_match() instead).
  """Entry point for launching an IPython kernel."

Tags: 代码警告rawmodelmodelssavematch错误
1条回答
网友
1楼 · 发布于 2024-06-09 00:05:59

出现此警告是因为指定的函数将在gensim的未来版本中被弃用,作者希望用户能够清楚地看到这一点。你知道吗

可以使用以下方法禁用这些警告:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

相关问题 更多 >