<jupyter_start><jupyter_text>Convolutional Network Model Train for 5 epochsObserve the loss decreasing while training.<jupyter_code>%%capture
!python ConvolutionalNetwork.py --max_epochs=5<jupyter_output><empty_output><jupyter_text>Inspect logs⚠️ Make sure to **Stop** the cell execution after observing the logsAfter only **5 epochs**, the model achieves **98.5% accuracy** on the MNIST test data set.It performs better than the previous neural network model.<jupyter_code>!tensorboard --logdir=./lightning_logs<jupyter_output>^C<jupyter_text>Load trained modelCheckpoints are saved incrementally for each training session under `./lightning_logs/version_X`.<jupyter_code>__import__("sys").path.append("..")
import utils
from ConvolutionalNetwork import ConvolutionalNetwork

model = utils.load_trained_model_for_evaluation(ConvolutionalNetwork, 3)
print(model)<jupyter_output>ConvolutionalNetwork(
  (seq): Sequential(
    (0): Conv2d(1, 16, kernel_size=(5, 5), stride=(1, 1))
    (1): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (2): ReLU()
    (3): Conv2d(16, 32, kernel_size=(3, 3), stride=(1, 1))
    (4): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (5): ReLU()
    (6): Flatten(start_dim=1, end_dim=-1)
    (7): Linear(in_features=800, out_features=10, bias=True)
    (8): LogSoftmax(dim=1)
  )
)<jupyter_text>Predict MNIST labels<jupyter_code>import torch
import random

test_len = model.mnist_test.data.shape[0]

for i in range(0, 10):
    orig_img, orig_label = model.mnist_test[random.randint(0, test_len)]
    orig_img = orig_img.view(1, 1, 28, 28)
    classes = model(orig_img)
    predicted_label = torch.max(classes.data, 1).indices.item()

    print("Original label: ", orig_label, "Predicted label: ", predicted_label)
    utils.plot_images([orig_img.view(28, 28)])<jupyter_output>Original label:  8 Predicted label:  8
{'fraction_non_alphanumeric': 0.1311647429171039, 'fraction_numerical': 0.03620146904512067, 'mean_word_length': 6.223484848484849, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '233487', 'license': 'MIT', 'n_tokens_mistral': 714, 'n_tokens_neox': 672, 'n_words': 152, 'path': '04-Convolutional-Network/Notebook.ipynb', 'repo_name': 'DSergiu/pytorch-lightning-beginner', 'size': '1906'}