首页 > 解决方案 > 在 tensor2tensor 中运行示例项目

问题描述

我正在尝试从以下位置在我的 Windows 电脑上执行该程序:

https://github.com/GoogleCloudPlatform/training-data-analyst/blob/master/courses/machine_learning/deepdive/09_sequence/poetry.ipynb

我正在尝试首先生成数据。但是这个命令不起作用。

\Anaconda3\Scripts> python .\t2t-datagen --t2t_usr_dir=C:\Users\NLP\t2t-poetry --problem=PoetryLineProblem --data_dir=.\t2t_data --tmp-dir=C:\Userst2t-poetry\tmp

它给出一个错误:

Anaconda3\lib\site-packages\tensor2tensor\bin\t2t_datagen.py", line 196, in main
    raise ValueError(error_msg)
ValueError: You must specify one of the supported problems to generate data for:
  * algorithmic_addition_binary40
  * algorithmic_addition_decimal40

看起来问题没有得到解决。我确实有链接中提到的代码:

相同的代码:

@registry.register_problem
class PoetryLineProblem(text_problems.Text2TextProblem):
  """Predict next line of poetry from the last line. From Gutenberg texts."""

  @property
  def approx_vocab_size(self):
    return 2**13  # ~8k

我在 ....\t2t-poetry\trainer\problem.py 有这个文件

你能告诉我我错过了什么吗?

标签: nlptensor2tensor

解决方案


问题名称必须在snake_case 中指定。从CamelCase 转换为snake_case 即PoetryLineProblem 到poetry_line_problem


推荐阅读