简体   繁体   English

在 tensor2tensor 中运行示例项目

[英]Running a sample project in tensor2tensor

I am trying to execute the program on my windows pc from:我正在尝试在我的 windows 电脑上执行程序:

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

I am trying to first generate data.我正在尝试首先生成数据。 But this command is not working.但是这个命令不起作用。

\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

Its giving an Error:它给出一个错误:

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

Looks problem is not getting taken.看起来问题没有得到解决。 I did have the code as mentioned in the link:我确实有链接中提到的代码:

same code:相同的代码:

@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

I have this file at....\t2t-poetry\trainer\problem.py我有这个文件在....\t2t-poetry\trainer\problem.py

Can you please let me know what I am missing.你能告诉我我错过了什么吗?

The problem name has to be specified in snake_case.问题名称必须在snake_case 中指定。 Convert from CamelCase to snake_case ie PoetryLineProblem to poetry_line_problem从CamelCase 转换为snake_case 即PoetryLineProblem 到poetry_line_problem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM