0

I have a Trax loop object, from which I would like to extract a task object. The code below returns the error AttributeError: 'Loop' object has no attribute '_task'. Do you have suggestions on how to fix this?

Background info: I am trying to run on a GPU setting the code of W4 assignement of the Coursera course "Natural Language Processign with Attention Models".

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

Here is the error message:

<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'
desertnaut
  • 57,590
  • 26
  • 140
  • 166
albus_c
  • 6,292
  • 14
  • 36
  • 77

1 Answers1

1

No access to the coursera course:/, can you try the following properties?

  1. test_loop.tasks, which returns the training tasks.
  2. test_loop.eval_tasks, which returns the evaluation tasks.

You can find more properties from trax doc: https://trax-ml.readthedocs.io/en/latest/trax.supervised.html#trax.supervised.training.Loop.tasks

Yuwen Yan
  • 4,777
  • 10
  • 33
  • 63