【问题标题】:Select task from Trax loop从 Trax 循环中选择任务
【发布时间】:2020-12-21 13:57:43
【问题描述】:

我有一个 Trax 循环对象,我想从中提取一个任务对象。下面的代码返回错误AttributeError: 'Loop' object has no attribute '_task'。你对如何解决这个问题有什么建议吗?

背景信息:我正在尝试在 GPU 上运行,设置 Coursera 课程“Natural Language Processign with Attention Models”的 W4 分配代码。

test_loop = training_loop(ReformerLM, train_stream, eval_stream)
type(test_loop)
train_task = test_loop._task

这是错误信息:

<class 'trax.supervised.training.Loop'>

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-34-937f26e690d0> in <module>
      1 test_loop = training_loop(ReformerLM, train_stream, eval_stream)
      2 print(type(test_loop))
----> 3 train_task = test_loop._task
      4 #eval_task = test_loop._eval_task
      5 

AttributeError: 'Loop' object has no attribute '_task'

【问题讨论】:

  • 代码在 Coursera notebook 中运行良好...是因为他们使用 TPU 吗?

标签: python trax


【解决方案1】:

无法访问 coursera 课程:/,您可以尝试以下属性吗?

  1. test_loop.tasks,返回训练任务。
  2. test_loop.eval_tasks,返回评估任务。

您可以从 trax 文档中找到更多属性:https://trax-ml.readthedocs.io/en/latest/trax.supervised.html#trax.supervised.training.Loop.tasks

【讨论】:

    猜你喜欢
    • 2016-03-22
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    • 2011-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-10
    相关资源
    最近更新 更多