<jupyter_start><jupyter_text>Downloading the model from Google Drive<jupyter_code>#@title Imports
from pathlib import Path
#@title Config
BASE_DIR = Path(".")
GOOGLE_DRIVE_FOLDER = "/content/drive/MyDrive/tensorflow"

model = "training_cleaned_model"
model_logs_dir = Path("2021-08-17T13:18:08.809100")
drive_model_logs = Path(GOOGLE_DRIVE_FOLDER) / model / model_logs_dir
#@title Copy the model checkpoints and logs from Google Drive
from google.colab import drive

drive.mount("/content/drive")

!rm -rf {model_logs_dir}
!cp -r {drive_model_logs} .<jupyter_output>Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).<jupyter_text>Loading the saved model<jupyter_code>#@title Imports
from tensorflow.keras import models
import tensorflow as tf

print(f"Tensorflow: {tf.__version__}")
#@title Load the model
model_checkpoints_dir = model_logs_dir / "checkpoints"
model = models.load_model(model_checkpoints_dir)
model.summary()<jupyter_output>Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
embedding (Embedding)        (None, 16, 100)           11770800  
_________________________________________________________________
bidirectional (Bidirectional (None, 128)               63744     
_________________________________________________________________
dropout (Dropout)            (None, 128)               0         
_________________________________________________________________
dense (Dense)                (None, 16)                2064      
_________________________________________________________________
dense_1 (Dense)              (None, 1)                 17        
=================================================================
Total params: 11,836,625
Trainable params: 65,825
Non-trainable params: 11,770,800
_______________________________________[...]<jupyter_text>Model evaluation<jupyter_code># %load_ext tensorboard
# tensorboard_logs_dir = model_logs_dir / "logs"
# %tensorboard --logdir={tensorboard_logs_dir}<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13667117726657646, 'fraction_numerical': 0.034280559314388816, 'mean_word_length': 4.97843665768194, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '237199', 'license': 'MIT', 'n_tokens_mistral': 645, 'n_tokens_neox': 570, 'n_words': 133, 'path': 'notebooks/tweet_sentiment_analysis_with_GloVe_embeddings_loading_saved_model.ipynb', 'repo_name': 'harisonmg/tensorflow-exam-prep', 'size': '2217'}