gensim保存负载模型弃用警告 [英] gensim save load model deprecation warning

查看:162
本文介绍了gensim保存负载模型弃用警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I get the following deprecation warning when saving/loading a gensim word embedding:

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:

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

我不知道如何遵循页面上的说明进行操作.因此,我应该如何保存并打开我的模型呢?

I don't understand what to do following the notes on the page. So, how should I save and open my models instead?

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

I use python 3.7 , gensim 3.7.3. and smart_open 1.8.4. I think I did not get the warning when using gensim 3.7.1. and python 3.5. smart_open should have been 1.8.4.

推荐答案

您可以忽略大多数弃用警告",因为它们只是有关目前仍在起作用的基础更改的建议,但是有一种新的首选方法将来可能需要的东西.

You can ignore most "deprecation warnings", as they're just an advisory about underlying changes that for now still work, but there's a new preferred way to do things that may be required in the future.

在这种情况下,警告是有关 gensim 包正在使用的 smart_open 包中的函数的.也就是说,您调用的不是不是 .save(),而是 .save()中的某些东西. gensim 的作者最终将更新 .save(),以使用 smart_open 提供的新首选变体.

In this case, the warning is about a function inside the smart_open package that the gensim package is using. That is, it's not the .save() you are calling that's deprecated, but something inside .save(). The gensim authors will eventually update .save() to use the newly-preferred variant of what smart_open offers.

只要情况仍然适用,您就可以继续使用 .save(),而忽略该消息–除非您想为 .save()删除对 gensim 的警告.(但是,它可能已经在开发代码中修复,可以在下一个 gensim 版本中使用.)

You can just keep using .save(), ignoring the message as long as things still work for you – unless you'd like to contribute the fix to .save() to remove the warning to gensim. (It may, however, have already been fixed in the development code, to become available in the next gensim release.)

这篇关于gensim保存负载模型弃用警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆