【问题标题】:"How to Fix:TypeError __init() got an unexpected keyword argument 'max_value' relating to Progress Bar“如何修复:TypeError __init() 得到了一个与进度条相关的意外关键字参数‘max_value’
【发布时间】:2020-01-19 15:14:39
【问题描述】:

我目前正在尝试使用 Mozilla deepspeech 训练语音识别模型。这已经在linux上完成了。 MacOs 从来没有遇到过问题,但现在遇到了问题。

我已经厌倦了两次设置我的虚拟环境来解决这个问题,但它仍然存在。如上所述,我已经在 MacOs 上尝试过,但在 linux 上我似乎遇到了问题。会不会是在 linux 和 mac 上安装 python 依赖的方式不同?

  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/chabani/tmp/deepspeech-train-venv/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Loading TSV file:  /media/sf_en/train.tsv
Saving new DeepSpeech-formatted CSV file to:  /media/sf_en/clips/train.csv
Importing mp3 files...
Traceback (most recent call last):
  File "bin/import_cv2.py", line 166, in <module>
    _preprocess_data(PARAMS.tsv_dir, AUDIO_DIR, label_filter_fun, PARAMS.space_after_every_character)
  File "bin/import_cv2.py", line 43, in _preprocess_data
    _maybe_convert_set(input_tsv, audio_dir, label_filter, space_after_every_character)
  File "bin/import_cv2.py", line 100, in _maybe_convert_set
    bar = progressbar.ProgressBar(max_value=num_samples, widgets=SIMPLE_BAR)
TypeError: __init__() got an unexpected keyword argument 'max_value```

I expected that the data to train the model would import appropriately but it appears to not do so due to an incompatible progress bar.

【问题讨论】:

  • 您完全确定安装了正确的依赖项吗?有两个“进度条”模块的行为完全不同。 progressbar 已经有一段时间没有更新了,但 progressbar2 似乎正在积极处理中。您能否验证在两个环境中都安装了完全相同的软件包?
  • 请出示相关代码。另请参阅How to create a Minimal, Complete, and Verifiable example。
  • 非常感谢@HampusLarsson。成功了

标签: python linux terminal


【解决方案1】:

您可能在 GNU/Linux (pip install progressbar) 中安装了 progressbar,而不是 progressbar2 (pip install progressbar2)。

前者接受maxval,而progressbar2 处理需要的max_value。

【讨论】:

  • 非常感谢@ipaleka。这个建议奏效了。
【解决方案2】:

也许您正在使用进度条而不是进度条2

  • 注意:在progressbar2中,“ma​​xval”已被弃用,所以,现在我们应该使用 最大值
  • 您必须在python3.7环境中运行您的代码以避免错误 因此,使用从系统中卸载以前的进度条 pip3 卸载进度条 然后通过
    安装progressbar2 pip3 安装进度条2 如果你是 linux 用户 采用 sudo pip3 安装进度条2
  • 在 cmd 或命令 shell 中运行你的 python 文件 - python3.7 your_file_name.py

【讨论】:

  • 谢谢,问题已通过建议的方法解决
猜你喜欢
  • 2019-12-19
  • 2021-01-03
  • 2016-09-17
  • 1970-01-01
  • 1970-01-01
  • 2012-12-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多