I just finished the courses. However, having finished, I have lost access to material.
I downloaded the exercises earlier. But running into issues when I
try to run C5_W4_A1_Transformer_Subclass_v1.ipynb locally on my Mac now.
These seem to be related to version of the packages installed. Especially of tensorFlow, Keras. Could be others.
Could someone tell me which versions are being used.
Anyone can get the list of package versions by
adding at the top:
import sys #<—
!{sys.executable} -m pip list #<—
import tensorflow as tf
import time
import numpy as np
import matplotlib.pyplot as plt
If someone currently in the course can provide the list, that would be very helpful for me run the material locally.
It may be a bit of a hassle to use the info in that form. I also did this:
!pip freeze > requirements-pip_freeze.txt
And the resulting file is attached (note that I had to add the fake “dot py” extension in order to get it to upload). requirements-pip_freeze.txt.py (3.0 KB)
Great, thanks! I don’t know how exactly or if I can directly make use of it to create the environment(with maybe Conda) – will figure it out. Seems most packages are older than I have which is an issue.
In case you prefer to use conda instead of pip, since conda will let you maintain multiple environments in parallel, here is the result of the other command shown on that thread that I linked above:
!conda list --export > requirements-conda_list.txt
Yes, the assignments use old versions of things. Most of the assignments here were last updated in a major way in April 2021, when they did the conversion from TF 1.x (no eager execution) to TF 2.x. So each assignment uses whatever versions were current at the time it was last published. This can be a problem, because things in this general space (python libraries and ML related packages like TF) evolve quickly and (unfortunately) do not always do so in backwards compatible ways.
The other thing to note here is that there is no guarantee that the versions shown above for C5 W4 A1 apply to all assignments in DLS. There are assignments in DLS C4 that use TF 2.3.0 and some that use TF 2.9.1. The one here uses TF 2.4.0. So this is why you might want to use conda, so that you can easily support multiple different sets of versions of everything.
Just realized this. I have not yet gotten it to work as it did when I submitted, all tests passing. Currently I have it ‘working’ in the latest env. The system goes through the ‘complete motions’, i.e., without syntactic errors but outputs ‘fail’, the numerical comparisons yield failure. Not sure if this is because the later versions have more/less/different precision, slight variations in internal algorithms or if the failures are real. For now, I have left it in this state. At some point hoping to revisit. Didn’t realize it could take up so much time(more than a week) to get to this stage.
If you are taking the approach of modifying things to run with the current versions of the packages, then you may well get different numeric results. Note that with TF it’s not really possible to get identical results even when you set the random seeds. The issue is that the training is parallelized and that process is fundamentally non-deterministic. They may have changed the behavior of the parallelization logic in the later versions. There is a flag you can set to get deterministic results, but it basically disables most of the parallelization, so it slows everything down. Here’s a post from mentor Raymond that explains this point.
Or they could have just changed things in other more direct ways that change the resolution of the outputs. Of course even if it’s more numerically accurate, that could still be “different”.
In the assignment, you’ll notice 2 imports from the transformers library:
from transformers import DistilBertTokenizerFast #, TFDistilBertModel
from transformers import TFDistilBertForTokenClassification
They are dead code and can be safely removed (you don’t need the transformers library to do the assignment). Since tensorflow depends on numpy, installing tensorflow is sufficient.