WEBVTT

00:00.080 --> 00:00.960
Welcome back.

00:01.080 --> 00:05.040
We saved and exported the trained model successfully.

00:05.080 --> 00:08.720
Now let's learn how to load saved models.

00:08.720 --> 00:11.240
Your exported model consists of.

00:11.640 --> 00:14.400
Saved model file.

00:14.440 --> 00:15.760
Model architecture.

00:15.800 --> 00:16.360
Graph.

00:16.560 --> 00:18.120
Graph variables.

00:18.280 --> 00:19.160
Folder.

00:19.400 --> 00:20.040
Model.

00:20.040 --> 00:21.880
Weights and training state.

00:22.120 --> 00:23.680
Assets folder.

00:23.960 --> 00:28.440
Additional files like vocabularies and the fingerprint of PB file.

00:28.480 --> 00:33.720
You typically can't just load the single PB file.

00:33.720 --> 00:43.200
I can't load this saved model PB file alone because it only contains the model architecture, not the

00:43.200 --> 00:43.880
weights.

00:43.880 --> 00:48.960
The PB file needs the variables folder to work properly.

00:48.960 --> 00:57.120
To do the correct loading process of the exported models, we need to use our friend TensorFlow.

00:57.520 --> 01:01.920
So here loading the exported Models.

01:01.920 --> 01:10.760
Let's start by creating a new variable called loaded model equals to TensorFlow dot saved model dot

01:10.800 --> 01:11.560
load.

01:11.560 --> 01:19.720
And here you should specify the exact name of the linear regression export model or any other model

01:19.720 --> 01:20.880
you need to load.

01:20.880 --> 01:25.400
So here please pay attention to the name of the model.

01:25.640 --> 01:30.800
It should match this or otherwise it will give you an error.

01:30.920 --> 01:34.200
Print TensorFlow model loaded successfully.

01:34.200 --> 01:34.880
Let's run.

01:34.880 --> 01:39.000
And here we go TensorFlow model loaded successfully.

01:39.040 --> 01:42.760
Now we're going to work with this loaded model.

01:42.760 --> 01:47.400
We're going to forget the model that we created locally.

01:47.400 --> 01:50.640
And we're now we're going to use this loaded model.

01:50.640 --> 01:52.840
So let's test the loaded model.

01:52.880 --> 01:55.440
Let me make some predictions here.

01:55.440 --> 01:58.760
We need to access the default serving function.

01:58.760 --> 02:01.960
Serve function equals to loaded modal.

02:01.960 --> 02:07.880
I'm accessing this loading loaded modal signatures and serving defaults.

02:07.880 --> 02:12.760
Here we get the main function that do the job.

02:12.880 --> 02:18.080
Then we're going to use the loaded model to make predictions.

02:18.080 --> 02:24.120
So test input variable equals to t f dot constant.

02:24.360 --> 02:28.120
Let me pass $1,500.

02:28.120 --> 02:37.160
So this is the size sorry 1500ft² of the size of the uh, of the house.

02:37.160 --> 02:40.520
And we need to get the prediction of the price.

02:40.560 --> 02:41.080
Okay.

02:41.320 --> 02:49.720
Then run the inference serve function, the function that we we need to access and the default serving

02:49.720 --> 02:50.360
function.

02:50.360 --> 02:55.000
And we pass the test input, which is $1,500.

02:55.000 --> 03:02.810
So here sorry square feet size equals to Square feet.

03:02.850 --> 03:05.290
Okay, let me print the predictions.

03:05.290 --> 03:06.050
Run here.

03:06.050 --> 03:07.010
And here we go.

03:07.130 --> 03:14.130
Prediction output tensor flow shape one one array, one dimension.

03:14.130 --> 03:21.810
And the float of the output is uh is of type float and num array.

03:21.810 --> 03:31.890
We can we have an array here containing the result which is 6.5 for thousand dollars.

03:31.890 --> 03:34.490
So the prediction works fine.

03:34.530 --> 03:43.970
Here we are getting the type of the prediction which is a float, and a num array which is a 6.54,

03:44.130 --> 03:49.090
which is the result of 1500ft² house.

03:49.130 --> 03:49.650
Okay.

03:49.850 --> 03:51.730
So congratulations guys.

03:51.930 --> 03:57.890
We loaded successfully the model and we use it in order to make.
