gensim保存负载模型弃用警告

ive*_*ion 3 gensim

保存/加载gensim词嵌入时,我收到以下弃用警告:

model.save("mymodel.model")

/home/.../lib/python3.7/site-packages/smart_open/smart_open_lib.py:398: 
UserWarning: This function is deprecated, use smart_open.open instead. 
See the migration notes for details:
Run Code Online (Sandbox Code Playgroud)

https://github.com/RaRe-Technologies/smart_open/blob/master/README.rst#migrating-to-the-new-open-function

  'See the migration notes for details: %s' % _MIGRATION_NOTES_URL
Run Code Online (Sandbox Code Playgroud)

根据页面上的说明,我不知道该怎么办。那么,我该如何保存并打开我的模型呢?

我使用python 3.7,gensim 3.7.3。和smart_open 1.8.4。我认为使用gensim 3.7.1时没有得到警告。和python 3.5。smart_open应该是1.8.4。

goj*_*omo 6

您可以忽略大多数“弃用警告”,因为它们只是有关目前仍在起作用的基础更改的建议,但是有一种新的首选方式可以做将来可能需要做的事情。

在这种情况下,警告是关于smart_opengensim软件包正在使用的软件包内部功能的。也就是说,它是不是.save()你拨打的弃用,但里面的东西.save()。该gensim作者最终将更新.save()使用什么的新优选的变型smart_open优惠。

.save()只要一切仍对您有效,您就可以继续使用它,而忽略该消息-除非您想提供修复程序.save()以消除对的警告gensim。(但是,它可能已经在开发代码中修复,可以在下一个gensim版本中使用。)