Hi and welcome back to this, but course, so now that we have made our preparation for the evaluation,
we are almost ready to finally make our predictions and to create the file that we will use for the
inauguration.
But as we will use the right predictions function that was written by Google, we will need to do one
or two things so that everything comes in the right format called this function.
And the first thing we will need to do is to create real results that will be collections that named
Dupo.
So basically inevitable is a subclass of tuple, but with nine fields.
So that means that Colling, that we can create Topo's each element, having a name attached to it.
So it's kind of the same thing as a dictionary in the sense that we can have access to elements according
to the names, but it's still a tuple.
So there is an order.
And for each team we can only have one element.
So yeah, it's just a couple with named Fields and those tuples will be named wrote results.
And the fields will have full name unique ID, so that will be the ID of the question we are answering
to then start Logits.
So that will be the outputs of our model for the beginning of the answer.
So all the calls for each would to be the beginning of the answer and and logits.
Same thing for the end of the answer, so that's for this could define then as we work with patches,
we want to create a function that will return the elements of the budget output once at a time.
So we will call that gets real results and this takes the predictions.
And so what we will do is that we will zip together the unique IDs, start logits and and logits, and
then we will get each element of this zip content one at a time.
So basically when we zip, we put together three lists of size for something for being the batch size
in our case.
So we put them together and everything's become a big element of size four, three and something.
So if we access everything one after the other right after it, that means that we get access to the
elements of the batch, one after the other.
So we need to write for unique ideas, starts Logits and Logits in zip predictions.
Unique ideas, predictions.
Starts Logits.
And predictions.
And Logits, so that allows us to look over the budget dimension of those three elements at the same
time.
So the first iteration of this loop will contain the first element of this, the first element of that
and the first element of that.
So that means the results of the first element of the batch for this, this and that.
And now basically those three elements, we just want to return them as the real results.
And in order to do that, we call yield real results, unique ID equals unique I.D. and we want to get
the numbers right out of it.
The start.
Stotz Logits.
Equals starts logits dot and then Pi dot two lists, this time you want to have a list because this
is the format that we will use later to call the Google function to write our file.
And finally, something with the end logits equals and logits that and by those two lists.
OK.
And then by and by the way, if you are not familiar with this yield, would that means that this function
is actually an iterator?
So this means that it will behave when we call it with a prediction like any other iterator, so we
could loop over something like get real results.
My predictions, this becomes something we can loop over.
We can have access to all the elements, one after the other.
That's what this yield comes from.
And that's the whole point of this.
It is to get the unique ideas, start logits and end logits for each question, one after the other.
In this form, even if they come in a box form, we will return them one after the other.
So that's the whole point of this function.
So now we are finally able to write our loop that would make the predictions and write everything in
our own results lists.
Equals and so full counts, inputs in enumerates.
Evo data sets.
What we will do is we will take only the input parts of what we called inputs because, of course,
our data set contains the inputs and the answer to the question.
So by doing that, we get rid of the answer and we just get the inputs and then those that contains
the three different types of tokens that we use for our best player.
But it also contains the unique ID, which is the ID corresponding to our common question.
So we want to prove that.
So we want to remove it from X while keeping it into unique ID is viable.
So we just need to do unique IDs equals Eckstut, Bob.
Unique I.D., So now the I.D. of the question we are answering is not an X anymore and it is a unique
I.D. So now we can call our birth squad model to get these thoughts.
Logits, the end logits, and this will be equal to births Squad X, and we are not in a training phase,
so we want to apply the drop out.
So training equals.
Now we need to create the dictionary that we will pass to get real results.
And that's actually really simple.
All we have to do is to create output's.
DECT, which is DECT, and basically we'll just call unique ideas being our unique ideas, something
for start Logits equals starts logits and end Logits equals and logits.
So this is exactly the same format as what we call here so that we fit perfectly in our get real, actually.
Yeah.
Let's get real results right here.
So now that half hour, I predict we can just have access to each unique ID strategies and and logits
one after the other by calling for results in get real results.
Output's dect, we just append the results to all the results, so all results we will put in there.
So that makes more sense, that append results, that's it.
So that's actually our whole move to create the results that we will then write into adjacent file.
And just because it's quite a long process, we will actually if count.
Can be divided by, let's say, one hundred will prince the current step, so we will just very simply
say that this is our step, this is the total number of step.
And so in format, we put counts and we put the total number of step and actually they are two thousand
seven hundred and nine batches that have been created.
So that's our look.
As I said, it takes some time, actually.
It can almost take a few hours.
But once we have our own results, we just have one final line to write in order to get our production
file.
And in order to do that, we need to define three different paths for three different files that we
want to create.
The first one is the one we are interested in.
The two other ones are files that are created by Google, but we need to mention the path to the function
so that it works well.
So output prediction.
File will be equal to and once again, let's do a quick copy passed, so I will show you where I put
those projects.
But.
Gator squad, and this is the one we are talking about right now, so this is the path for predictions
that season, then we need to create outputs and bests file because.
And this is this one, so we'll just copy paste once again, and the last one we need to create is Output's
No Lugg Odd's file.
Actually those two files are never used.
It's the only one that got interested in our projections.
I guess those are files that Google used in order to debate or to work on their models.
But the things that we need to put those parts to the right, predictions that we will call right after
it so that it works fine.
So for this last file, we will use the same path, just adding new odds that Jaeson.
OK, so those are the three parts that we needed to declare.
And now we're ready to call the last function, which is right.
Predictions.
So we need to give it the eval examples that we created before the AVL features.
Then the thing that really is interesting and that we created by ourselves are all results.
So this just contains all the ideas to the question we are answering to.
And this calls for the first the beginning of the answer and the end of the answer.
Then, as you can see here, we need to specify an end, best side and most excellent.
So those are just numbers that were somewhere in the code of Google.
And I just picked them in the source code and they are actually 20 and 30.
Then you do lower case in our case, it's actually true.
That means that during the closing phase, they applied to the lower case function.
And then finally, we just have to specify the outputs, prediction, file the outputs and best.
File and the output's no log.
It's file and finally, let's say that they're both equal force, even though it's actually the default
value, because you don't want to print that many things.
Actually, there is just a typo here.
OK, so this once we'll have all the previous sales of the evaluation board's computed, really creates
the prediction that she's in file.
And this will finally be usable to assess how our model has performed using a script provided by this
team.
So this is the topic of our next lecture.
We will finally be able to see how much we performed.
So let's get to this last step and see you soon.