Error running C5W3 neural machine translation locally

I’ve finished all the assignments and downloaded all the assignments, trying to verify my downloaded assignments are working by running them locaslly… I faced the following error when running the C5W3 neural machine translation assignment locally:
NotImplementedError: Cannot convert a symbolic Tensor (bidirectional_1/forward_lstm_2/strided_slice:0) to a numpy array. This error may indicate that you’re trying to pass a Tensor to a NumPy call, which is not supported

this is the cell after the unit test for UNQ_C2. the cell contains this:
model = modelf(Tx, Ty, n_a, n_s, len(human_vocab), len(machine_vocab))

previously the unit test for C2 already generated similar error, but I could comment it away and skip it… but if I can’t run this cell, I can’t proceed with the rest of the cells. The codes run just fine on the course’s site…

my environment:
python: 3.8.5
tensorflow-gpu: 2.4.1
OS: linux mint 19.3
GPU: titan X

if someone can advice me on how to set up the course’s environment of tf2.3.0 that would be great… or advice me how to fix this issue…

The emoji assignment (C5W2) also has similar error and can’t byoass as it’s not unit test cell…

I have tried running the emoji assignment using tf2.2/python 3.6 and it was able to work… but this assignment still can’t … giving another error… so obviously it’s something to do with the new version missing some implementation…

anyone has any advice for me? much appreciated. :slight_smile:

this could be useful for those who are encountering the errors running locally with tf=2.4.x. the root cause is that tf=2.4.x is not compatible with numpy=1.20.x which the conda environment will install if you used the command “conda install tensorflow-gpu”, whick will install tf=2.4.x with numpy 1.20.x. you’ll need to “downgrade” numpy to >=1.19.6 and <1.20. this line can work:

conda install -c conda-forge numpy=1.19.6

I’ve tried it and now the emojify’s shakespear section and the neural machine translation assignments can run with no more such errors.

hope this helps those facing the same issue… :slight_smile:

At this time it looks like the numpy package version 1.19.6 was removed? I tried to install from both PyPI and conda channels with no luck.

Is this question about the programming exercise, or about how to set up your local environment?