【问题标题】:Is this a bug on gensim hdp model for python 3.8?这是 python 3.8 的 gensim hdp 模型上的错误吗?
【发布时间】:2020-08-02 05:36:16
【问题描述】:

我想使用来自gensim 的 HDP 模型来获取我的语料库的主题数量,我已经使用这个语料库和字典来训练来自gensim 的常规 LDA 模型,它工作正常。但现在当我这样做时

hdp = models.HdpModel(bow_corpus, dictionary)

我明白了

Traceback (most recent call last):
  File "models.py", line 185, in <module>
    hdp = models.HdpModel(bow_corpus, dictionary)
  File "/usr/lib/python3.8/site-packages/gensim/models/hdpmodel.py", line 391, in __init__
    self.update(corpus)
  File "/usr/lib/python3.8/site-packages/gensim/models/hdpmodel.py", line 467, in update
    start_time = time.clock()
AttributeError: module 'time' has no attribute 'clock'

这是一个错误吗?

$ python --version
Python 3.8.2 (default, Feb 26 2020, 22:21:03) 

编辑以添加更多系统信息

>>> print(gensim.__version__)
3.8.1

uname -a
Linux ** 5.5.9-arch1-2 #1 SMP PREEMPT Thu, 12 Mar 2020 23:01:33 +0000 x86_64 GNU/Linux

【问题讨论】:

  • 如果您添加您使用的gensim 的版本和操作系统平台会有所帮助。

标签: python-3.x time gensim python-3.8


【解决方案1】:

您遇到了由deprecation of clock function of time module 引起的问题。一直是deprecated since Python v. 3.3 and removed in v. 3.8

要解决它,您有 2 个选项:

  1. 如果您没有最新版本,请尝试升级gensim
  2. 尝试降级 Python。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多