I am facing an error when trying to run Exercise 6 (in train_model) in week 1 assignment,
following is the error:
AttributeError Traceback (most recent call last)
in
2 # Take a look on how the eval_task is inside square brackets and
3 # take that into account for you train_model implementation
----> 4 training_loop = train_model(model, train_task, [eval_task], 100, output_dir_expand)
in train_model(classifier, train_task, eval_task, n_steps, output_dir)
20 eval_tasks=eval_task[0], # The evaluation task
21 output_dir=output_dir, # The output directory
—> 22 random_seed=31 # Do not modify this random seed in order to ensure reproducibility and for grading purposes.
23 )
24
/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)
241 # NOTE: If random_seed is None then self._rng will be different on
242 # different hosts, leading to different weights on the different hosts.
→ 243 self._batch_signature = shapes.signature(tasks[0].sample_batch)
244 self._model.rng = self.new_rng()
245 # In the memory-efficient case, we initialize in init_trainer.
/opt/conda/lib/python3.7/site-packages/trax/shapes.py in signature(obj)
95 “”"
96 if isinstance(obj, (list, tuple)):
—> 97 output = tuple(signature(x) for x in obj)
98 return output if isinstance(obj, tuple) else list(output)
99 elif isinstance(obj, dict):
/opt/conda/lib/python3.7/site-packages/trax/shapes.py in (.0)
95 “”"
96 if isinstance(obj, (list, tuple)):
—> 97 output = tuple(signature(x) for x in obj)
98 return output if isinstance(obj, tuple) else list(output)
99 elif isinstance(obj, dict):
/opt/conda/lib/python3.7/site-packages/trax/shapes.py in signature(obj)
95 “”"
96 if isinstance(obj, (list, tuple)):
—> 97 output = tuple(signature(x) for x in obj)
98 return output if isinstance(obj, tuple) else list(output)
99 elif isinstance(obj, dict):
/opt/conda/lib/python3.7/site-packages/trax/shapes.py in (.0)
95 “”"
96 if isinstance(obj, (list, tuple)):
—> 97 output = tuple(signature(x) for x in obj)
98 return output if isinstance(obj, tuple) else list(output)
99 elif isinstance(obj, dict):
/opt/conda/lib/python3.7/site-packages/trax/shapes.py in signature(obj)
100 return {k: signature(v) for (k, v) in obj.items()}
101 else:
→ 102 return ShapeDtype(obj.shape, obj.dtype)
103
104
AttributeError: ‘int’ object has no attribute ‘shape’