# UNQ_C8 Error ---> 42 output_dir=output_dir)

On Coursera someone else had this issue but their solution didn’t fix my project.


LayerError Traceback (most recent call last)
in
1 # UNIT TEST
2 # test training_loop
----> 3 w2_tests.test_training_loop(training_loop, TransformerLM)

~/work/w2_tests.py in test_training_loop(target, TransformerLM)
813 os.remove("~/model/model.pkl.gz")
814
→ 815 output_loop = target(TransformerLM, my_gen(), my_gen())
816
817 try:

in training_loop(TransformerLM, train_gen, eval_gen, output_dir)
40 train_task,
41 eval_tasks=[eval_task],
—> 42 output_dir=output_dir)
43
44 return loop

/opt/conda/lib/python3.7/site-packages/trax/supervised/training.py in init(self, model, tasks, eval_model, eval_tasks, output_dir, checkpoint_at, checkpoint_low_metric, checkpoint_high_metric, permanent_checkpoint_at, eval_at, which_task, n_devices, random_seed, loss_chunk_size, use_memory_efficient_trainer, adasum, callbacks)
246 if not use_memory_efficient_trainer:
247 if _is_uninitialized(self._model):
→ 248 self._model.init(self._batch_signature)
249 self._eval_model.rng = self.new_rng()
250 if _is_uninitialized(self._eval_model):

/opt/conda/lib/python3.7/site-packages/trax/layers/base.py in init(self, input_signature, rng, use_cache)
309 name, trace = self._name, _short_traceback(skip=3)
310 raise LayerError(name, ‘init’, self._caller,
→ 311 input_signature, trace) from None
312
313 def init_from_file(self, file_name, weights_only=False, input_signature=None):

1 Like

Honestly the testing needs to improve in this week and last week. Code is passing that has issues and you have no idea where it is broken when it finally breaks.

1 Like

Hi James_McDonough,

Sorry for the belated reply. If this is still an issue, can you send your notebook to me with a DM so I can have a look?

I’m having the same issue with the same error message. I also can’t figure out where the issue lies. Was any solution found?

I now tried to rerun the code the day after, and now it works, same code that failed yesterday.

I had same issue at same place.
In my case, using np functions causes issue.
After changing np to jnp , fixed.