C4W1-assignment 3.3 Loop

labID : lvedxyqk
I do not know all tests passed successfully until this point but I got error


LayerError Traceback (most recent call last)
in
9 train_task,
10 eval_tasks=[eval_task],
—> 11 output_dir=output_dir)

/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):

LayerError: Exception passing through layer Serial (in init):
layer created in file […]/, line 64
layer input shapes: (ShapeDtype{shape:(16, 128), dtype:int64}, ShapeDtype{shape:(16, 128), dtype:int64}, ShapeDtype{shape:(16, 128), dtype:float32})

File […]/trax/layers/combinators.py, line 106, in init_weights_and_state
outputs, _ = sublayer._forward_abstract(inputs)

LayerError: Exception passing through layer PrepareAttentionInput (in _forward_abstract):
layer created in file […]/, line 48
layer input shapes: (ShapeDtype{shape:(16, 128, 1024), dtype:float32}, ShapeDtype{shape:(16, 128, 1024), dtype:float32}, ShapeDtype{shape:(16, 128), dtype:int32})

File […]/jax/interpreters/partial_eval.py, line 419, in abstract_eval_fun
lu.wrap_init(fun, params), avals, debug_info)

File […]/jax/interpreters/partial_eval.py, line 1510, in trace_to_jaxpr_dynamic
jaxpr, out_avals, consts = trace_to_subjaxpr_dynamic(fun, main, in_avals)

File […]/jax/interpreters/partial_eval.py, line 1520, in trace_to_subjaxpr_dynamic
ans = fun.call_wrapped(*in_tracers)

File […]/site-packages/jax/linear_util.py, line 166, in call_wrapped
ans = self.f(*args, **dict(self.params, **kwargs))

File […]/site-packages/jax/linear_util.py, line 166, in call_wrapped
ans = self.f(*args, **dict(self.params, **kwargs))

LayerError: Exception passing through layer PrepareAttentionInput (in pure_fn):
layer created in file […]/, line 48
layer input shapes: (ShapeDtype{shape:(16, 128, 1024), dtype:float32}, ShapeDtype{shape:(16, 128, 1024), dtype:float32}, ShapeDtype{shape:(16, 128), dtype:int32})

File […]/trax/layers/base.py, line 743, in forward
raw_output = self._forward_fn(inputs)

File […]/trax/layers/base.py, line 784, in _forward
return f(*xs)

File […]/, line 27, in prepare_attention_input
mask = np.where(inputs, np.full_like(inputs, 1), np.full_like(inputs, 0))

File […]/<array_function internals>, line 6, in full_like
File […]/numpy/core/numeric.py, line 382, in full_like

res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape)

File […]/<array_function internals>, line 6, in empty_like

File […]/site-packages/jax/core.py, line 483, in array
raise TracerArrayConversionError(self)

jax._src.errors.TracerArrayConversionError: The numpy.ndarray conversion method array() was called on the JAX Tracer object Traced<ShapedArray(int32[16,128])>with<DynamicJaxprTrace(level=1/0)>
While tracing the function pure_fn at /opt/conda/lib/python3.7/site-packages/trax/layers/base.py:542 for eval_shape, this concrete value was not available in Python because it depends on the value of the argument ‘x’.

See JAX Errors — JAX documentation

Hi @Arij_AA,

When I look at your notebook, I see you have only attempted the implementation until Ex 6, and all of your unit tests until Ex 6 are passing, so I’m hoping that you were able to fix this.

Also, I noticed you have added extra code cells and code in the assignment. Be sure to delete those before submitting to the autograder, otherwise you’ll get errors in grading. You can read more on what not to do in an assignment under the note, Important Note on Autograder at the start of the assignment.

Best,
Mubsi

@Mubsi Yeah thanks, I was able to fix it, Now there is another issue it takes a very long time to execute the notebook and I can not submit the assignment.

Hi @Arij_AA, what do you mean that you cannot submit the assignment ?

@Mubsi I passed 90/100 .It was very slow and the notebook did not run until the end, then I submitted without runing the notebook.

Hello, I’m having the exact same issue… @Arij_AA was it simply a mistake in your code or does it have something to do with the lab framework ?

Thanks

Hello! at the begining I had errors in my code after fixing them I had another problem which is a very slow notebook running, that is why in the end I submitted without ending the notebook running.

I have the same issue, all my test before 3.3 have passed but I’m getting this error. Could you give me a hint to what went wrong or even tips to how to read trax errors?

I have the same issue, all my test before 3.3 have passed but I’m getting this error. Could you give me a hint to what went wrong or even tips to how to read trax errors?

Hi @Kathy_Razmadze,

Is this something you still need help with ?

Best,
Mubsi

Yes, I have this problem that I’m not able to solve, and I would be really glad to get some help.

Same issue here, everything is running smoothly until 3.3. which fails giving the same error as was noted earlier on this thread. Please advise.

Could you please let us know how you were able to fix the issue/error?

@Mubsi, I am having the same issue and unable to troubleshoot. Could you please provide some guidance?

Hi @Davit_Khachatryan,

Your mask logic is incorrect in Ex 3.

Best,
Mubsi

@Mubsi,
Thanks for pointing it out.