问题描述
(这里是 Trax 新手)我有一个 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,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课程:/,您可以尝试以下属性吗?
-
test_loop.tasks
,返回训练任务。 -
test_loop.eval_tasks
,返回评估任务。
您可以从 trax 文档中找到更多属性:https://trax-ml.readthedocs.io/en/latest/trax.supervised.html#trax.supervised.training.Loop.tasks