NER Assignment
Hello, I’m stuck creating the mask in Exercise 5. In the lecture, Jonas asks if we can think of a simple way to mask the padded values. I need a hint of how to do this in Exercise 5. I know that we mask the padded values in the loss function in Exercise 4. But here, I believe, we’re not calculating the loss, just masking the values, so I’m unsure how to perform the task. To be clear, I’m not getting an error in my function; it’s just returning an incorrect value.
My question concerns what goes on the mask = None line. I just need a hint about how to approach this line. Note: I have not included any answers in my image.
I’ve read through the threads, and I set the axis correctly. My question just concerns how the “create the mask.” For instance, do I need to call a function earlier in the assignment, create a conditional, or potentially call the Masking layer from tensorflow?
It may just be really simple, but the course materials repeatedly say you need to create a mask, but never demonstrate how to do so without just relying on built-in tensorflow functions.
This is just a note for later readers. I figured out this problem, but this moderator’s recommendation does not respond to my question. That is, you don’t need to use the tf.math.argmax function to create the mask; that function is of course for a later line when you’re identifying the predicted value.
If you have the same issue I did, my recommendation is to figure out a way to do y_true !=-1 to create the mask. TF has a built-in function for doing this, but it’s not mentioned in the lectures or the assignment notebook. I eventually found it in the TF documentation. Good luck and feel free to message me if you get stuck!