Hello, everyone, and welcome to this new session in which will treat Model Virgin with one TB.
Now, in the previous session we had looked at this had versioning in which we had created an augmented
version of our data, which happens to be this version right here from previous versions like a pre
processed version, another pre processed version and the original data.
And so from here we now going to see how to implement model versioning using this augmented data and
the untrained model version.
So we have this version of the model which is untrained and the augmented data which are going to be
passed in this run to produce our trained model version.
In the previous session, we saw how to implement data set versioning with one DB artifacts we left
from this original raw data right here onto this pre processed data.
We created a trained validation and test sets and then finally we had this augmented data right here
and now we are going to see how to make use of this augmented data in training our model.
But while training this model, we are going to implement model versioning and the two model versions
will have here will be the model before training and the model after training.
And so we're making use of this sequential model which we had created previously.
And the good news here is the way we implement model versioning is quite similar to the way we implement
dataset versioning.
We'll start by copying out this code and then we'll simply modify that.
In here we have this one DB model versioning, let's piece that out and then instead of augment data,
we are going to log our model.
So here we have log model, which is in fact this net model right here we have the log model want to
be in needs.
Our project entity specified the artifacts to be used here is known, so we're not going to make use
of any artifact to lock this model artifact right here.
And so we that we have this take of this augmented data.
We have our model let's call model or untrained, untrained model, and then we specify that it is this
untrained model, it's of type model.
So we have that type model, the initial version of our net model.
There we go.
Now we have that done this artifact file here.
We're going to make use of this.
We're not making use of any previous artifacts.
We just log in this model initially.
And then here, we'll take this off.
We're not going to make use of this just before writing in our model.
We're going to save that model.
So here we have this model to be saved.
We call it's all in that model, actually.
So we have learned model that safe and then we'll give it a file name.
So let's call it Loonette dot h five and that's it.
So we've saved this model.
Let's have this file name to be Loonette H five.
So let's define this Loonette H five file here and take this off.
So we have now our file name.
Now, since we've already saved this file, instead of going through this process here, I've created
a new file and all of that.
We're just going to add a file.
So here we have our untrained model dot at file, and then we'll specify the file name.
So that's all we need to do.
And then we're going to also do one TB dot, save that file based on the file name and that's it.
So let's take off this part here and then we're going to log our artifact, which happens to be our
untrained model.
So we have your untrained model, and that's fine.
Now we could add in some merit.
Editor So let's have meta data, which equals our configuration, which we've defined already in here.
Let's modify this name.
This is our untrained model.
So your untrained model and that's fine.
So with this, we could now run this here.
We have this successful run right here, and then we could now go back to one to be getting back here.
We have this under our artifacts, we have the model.
So yeah, we could click on this model and then we specified the untrained model.
So let's click on this and we have this overview.
You see, we have that API metadata, you see the metadata we've locked in, we have the files, you
see the LINET model, and then we have, as usual, our grab view, which we could explode.
Notice that it's quite simple because for now it isn't linked to our data set.
So all we have is just this run which produces this untrained model or this initialized model.
From this point.
We'll go ahead to train our model and lock that trained version of the model.
So again, here we have this artifact, which we are going to use in training, the model which happens
to be our augmented data set.
Recall that we had logged this augmented data previously.
We could have this overview from here.
We have this augmented data set and then it's subtype pre processed data.
We've seen that already.
We download the data and then we create this new artifact which is going to be our trained sequential
model.
We call this trained sequential model subtype model description, a trained version of our model, as
simple as that.
So that is it.
We could also pass in the metal data, just as we had seen here with this log model where we pass in
the configuration.
So metadata equals our configuration, and that's fine.
Getting back to this augmented data method, we have seen previously, we're going to follow this same
pattern.
That is, we're going to download the data as we've done already.
We download the data and then we have this artifact file here.
The artifact file we're using was a trained data set because we needed to take this and convert it into
augmented data set.
And then we had this processing right here to produce dataset X and dataset Y.
Now we're going to do this exact procedure for training our data on the augmented data.
So let's paste this out right here and then your AR artifact file will be this data set.
So here we have our data set and we get this right from your let's get back to our data set files and
there we go.
We see we have this ARG data set Z, which we start previously.
And so once we are going to download this, we're going to have this file which is going to be found
in this folder, which is also found in this artifacts folder.
So we have artifacts, augmented data set version zero, which is from this.
This means that if we want to use the version one, we just simply have to specify your version of one
and so on and so forth.
So that said, we have our artifact file data set and then we go to this processing to obtain dataset
X and dataset Y, and then from here we'll go to this series of steps to convert this data into a TensorFlow
data set type data.
So here we have the x, dx, y, this dataset X, we convert to tensor, so we convert this dataset
X to a tensor and they said Y to a tensor.
Then from here we apply this from tensor slices method, which takes the X and D Y, That's our dataset
X, and this said Y to create this new dataset D.
Now we go to the same procedures we have seen already as we shuffle, we batch, we pre fetch and then
we have our training data set.
Now note that you could repeat this same process for the validation, but here we just do this for the
training and you could take it as an exercise to do the same for the validation.
Note that for validation we didn't make use of the augmented dataset.
We instead made use of the validation dataset itself.
Let's get to the graph review so you could see that.
Clara.
And as you could see here, we have this data which is pre processed pre processed data to train data,
set pre process data.
The validation that the separate process data test data set.
And then from here we had the augmented data, which is this one.
And so when you want to carry out validation, you're not going to be making use of this training data
obviously.
So we're going to make use of this one instead.
And so if you are to put in the validation in your that's convert the validation data into a TensorFlow
dataset type data and then use it for training and or evaluation, then you would have to make sure
you modify this year.
So that's that we continue with this process.
We have the trained data which we just created is now a tensorflow dataset type data.
And so training can now go on smoothly.
So you see here we have the metrics we've used to see in this already compiling and then we feed the
model.
So yeah, we're now going to include the validation.
We have that ready, we're going to do the training and after training our model would have this.
So let's, let's simply just have that net model that fit.
And then after this we will have similar to what we had seen already here in this log model method,
the file which has been saved and then saved to one TB, and then the artifact which has been locked.
So let's copy this out and then get back here and paste this.
Now let's change this name.
Let's see.
Loonette trained, Loonette trained.
That's our file name on train, model dot and file.
It's actually.
Yeah, we have this trained sequential model.
So let's have this as trained sequential model.
There we go.
We have the train sequential model or file file.
Name one, DBC file name, run the log artifact, the trained sequential model.
Trained sequential model.
Okay, So that's it.
So we have this set.
We could now run this method and then see what we get.
We obtain this error where we've been told the name Loonette models and defined now, as you had seen
previously with this log model method, we made use of the Loonette model, which we had defined right
here.
So we defined this Loonette model as using the sequential API, and that's what we had.
And this led us to having this year where we had a run.
So initially we had this run which produced our untrained model.
So we have this year on trained model, let's call it, um, untrained model.
And since in our case we're trying to build our train model is going to be reasonable for us to make
use of this untrained model which we have stored already in one DB since we're doing model versioning.
And so instead of us making use of this learned model, we are going to make use of this version of
the untrained model, which will start already in one DB.
So from here we're going to run another process which now will lead us to this trained model.
But then to run this process, we'll also need theater.
So as you could see, you have the data that's augmented editor From here we have the trained data.
We have different order notes which came before this.
So we call our weights in before having the untrained augmented data, which is this one year, and
then this augmented theater, together with this untrained model, will produce our trained model.
And once we have this trained model, we can now use it for prediction.
And so coming back again, if we had to use this Loonette model, which was defined here in the note
book, would have the this this data set that will have our data which will pass into the run, and
then we'll have our outputted train model.
And then on the other side we'll just have this output at like we have this run and then we have this
output, that untrained model.
So we have the untrained model and the trained model which should exist like two separate entities in
our global graph.
Whereas what we want to do is to be able to link this to up.
And so that's why we are not going to make use of this linear model which was defined here.
And this is why we're going to make use of the model which has already been stored in one DB.
That said, getting back to the code, we're going to copy this out here and then in the place of this
Loonette model, as in.
Of using the internet model with defined with defined.
Year.
We are now going to make use of our artifact which was stored already.
So let's let's have this here.
So let's have that pasted here and then we will make use of this artifact, which is in fact called.
The untrained model.
So you see, we have this year let's copy this out, we copy that out, and then we paste this here.
Let's paste this here and there we go.
Just after downloading the model, the next step will be to have this artifact file, which is simply
our untrained model, which we should have done, which we should have downloaded.
So in that case, we're going to have this year artifacts starting the artifacts, directory artifacts.
And then in here we take this all from years, copy this and paste out your untrained model.
And then to be more specific, we could get the file name from your.
So here you see, we have the file name you could get back here overview and then you have files little
net each five.
So this is a file we're going to download.
And yours is it your.
So we have that.
So now we have the artifact file which we want to download.
We have this path and then now we could make use of tensor flows, load model, method.
So here we have now the net model, which is equal to the cross models and load model which takes in
the artifact file.
There we go.
So now we have this little net model which is not gotten from this definition here, but which is gotten
from a previous version of our model, which has been stored in one DB.
So let's now run this and see what we get.
After training for over three E books, your other results we get and then we get to one DB.
You see here we have the model trained sequential model and then the all train model.
So let's click on this train sequential model loading artifacts.
There we go.
We could look at this API metadata which we loaded and the file.
So here we have Linet trained and then we also have our graph view explode in this view, here's what
we get.
Now, let's focus on this part here.
And as you can see, we have this run which produces this untrained model.
Here.
We have this untrained model and then this untrained model, together with our augmented data set,
been passed through this run, now produce our trained sequential model.
And that's it for the section in which we've seen how to implement model versioning with one DB.