diff options
-rw-r--r-- | docs/pytorch_vol2.ipynb | 388 | ||||
-rw-r--r-- | docs/researchML.ipynb | 1953 |
2 files changed, 2341 insertions, 0 deletions
diff --git a/docs/pytorch_vol2.ipynb b/docs/pytorch_vol2.ipynb new file mode 100644 index 00000000..7f931149 --- /dev/null +++ b/docs/pytorch_vol2.ipynb @@ -0,0 +1,388 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "pytorch.ipynb", + "provenance": [], + "collapsed_sections": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + }, + "accelerator": "GPU" + }, + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "lxhgSo4rOWCg", + "outputId": "5242373c-1d80-4a96-ef17-1243f7eea994" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Requirement already satisfied: torch in /usr/local/lib/python3.7/dist-packages (1.10.0+cu111)\n", + "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torch) (3.10.0.2)\n" + ] + } + ], + "source": [ + "pip install torch" + ] + }, + { + "cell_type": "code", + "source": [ + "print(torch.__version__)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "458HSdE3WK68", + "outputId": "be8888f7-f9ee-474f-b393-1d3545382b27" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "1.10.0+cu111\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "import torch\n", + "from torchvision import datasets, transforms\n", + "\n", + "import torch.nn as nn\n", + "import torch.nn.functional as F\n", + "\n", + "import torch.optim as optim\n", + "import matplotlib.pyplot as plt\n", + "\n", + "from tqdm import tqdm\n", + "\n", + "if torch.cuda.is_available():\n", + " device = torch.device(\"cuda:0\")\n", + " print(\"GPU\")\n", + "else:\n", + " device = torch.device(\"cpu\")\n", + " print(\"CPU\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "WoWY-yVoPKiI", + "outputId": "707345d2-53fb-4b01-f417-0c5b2db0aafa" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "GPU\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "class Network(nn.Module):\n", + " def __init__(self):\n", + " super().__init__()\n", + " self.input_layer = nn.Linear(784, 64)\n", + " self.hidden1 = nn.Linear(64, 64)\n", + " self.hidden2 = nn.Linear(64, 64)\n", + " self.output = nn.Linear(64, 10)\n", + "\n", + " def forward(self, data):\n", + " data = F.relu(self.input_layer(data))\n", + " data = F.relu(self.hidden1(data))\n", + " data = F.relu(self.hidden2(data))\n", + " data = F.relu(self.output(data))\n", + "\n", + " return F.log_softmax(data, dim=1)" + ], + "metadata": { + "id": "zHPjts1vPjDo" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "from torch.utils.data.dataset import T\n", + "training = datasets.MNIST(\"\", train = True, download = True,\n", + " transform = transforms.Compose([transforms.ToTensor()]))\n", + "\n", + "testing = datasets.MNIST(\"\", train = False, download = True,\n", + " transform = transforms.Compose([transforms.ToTensor()]))\n", + "\n", + "train_set = torch.utils.data.DataLoader(training, batch_size=10, shuffle=True)\n", + "test_set = torch.utils.data.DataLoader(testing, batch_size=10, shuffle=True)" + ], + "metadata": { + "id": "Phj4o7piR4FU" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "from torch.autograd import backward\n", + "network = Network().to(device)\n", + "learn_rate = optim.Adam(network.parameters(), lr=0.001)\n", + "epochs = 4\n", + "\n", + "for i in tqdm(range(epochs)):\n", + " for data in train_set:\n", + " image, output = data\n", + " image = image.to(device)\n", + " output = output.to(device)\n", + " network.zero_grad()\n", + " result = network(image.view(-1, 784))\n", + " loss = F.nll_loss(result, output)\n", + " loss.backward()\n", + " learn_rate.step()\n", + " print(loss)\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "eqIk--nMTYIm", + "outputId": "44638ff7-e230-4f03-e4a7-cda5f75ea10d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + " 25%|██▌ | 1/4 [00:15<00:45, 15.29s/it]" + ] + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "tensor(0.7714, device='cuda:0', grad_fn=<NllLossBackward0>)\n" + ] + }, + { + "output_type": "stream", + "name": "stderr", + "text": [ + "\r 50%|█████ | 2/4 [00:30<00:30, 15.16s/it]" + ] + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "tensor(0.9215, device='cuda:0', grad_fn=<NllLossBackward0>)\n" + ] + }, + { + "output_type": "stream", + "name": "stderr", + "text": [ + "\r 75%|███████▌ | 3/4 [00:45<00:15, 15.05s/it]" + ] + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "tensor(1.3817, device='cuda:0', grad_fn=<NllLossBackward0>)\n" + ] + }, + { + "output_type": "stream", + "name": "stderr", + "text": [ + "100%|██████████| 4/4 [01:00<00:00, 15.09s/it]" + ] + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "tensor(1.6124, device='cuda:0', grad_fn=<NllLossBackward0>)\n" + ] + }, + { + "output_type": "stream", + "name": "stderr", + "text": [ + "\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Test Network\n", + "network.eval()\n", + "\n", + "correct = 0\n", + "total = 0\n", + "\n", + "with torch.no_grad():\n", + " for data in test_set:\n", + " image, output = data\n", + " image = image.to(device)\n", + " output = output.to(device)\n", + " result = network(image.view(-1, 784))\n", + " for index, tensor_value in enumerate(result):\n", + " total += 1\n", + " if torch.argmax(tensor_value) == output[index]:\n", + " correct += 1\n", + "\n", + "accuracy = correct/total\n", + "print(f\"Accuracy: {accuracy}\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "fLRRyQnuYmRn", + "outputId": "0dc1fc3c-bf92-40dc-fd3a-d7d0335fc94e" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Accuracy: 0.7795\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from google.colab import drive\n", + "drive.mount('/content/gdrive', force_remount=True)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "97UyaTsHcIft", + "outputId": "be688931-b92b-4efb-b20e-12be438f03d8" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Mounted at /content/gdrive\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!ls '/content/gdrive/My Drive/TestPytorch'" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "RQop3IL3csZo", + "outputId": "635017e3-b7d2-42a1-9e5c-72e6fefc2f73" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "5.png 7.png\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "from PIL import Image\n", + "import numpy as np\n", + "import PIL.ImageOps\n", + "\n", + "img = Image.open(\"gdrive/My Drive/TestPytorch/5.png\")\n", + "img = img.resize((28, 28))\n", + "img = img.convert(\"L\")\n", + "img = PIL.ImageOps.invert(img)\n", + "\n", + "plt.imshow(img)\n", + "\n", + "img = np.array(img)\n", + "img = img / 255\n", + "image = torch.from_numpy(img)\n", + "image = image.float()\n", + "image = image.to(device)\n", + "\n", + "res = network.forward(image.view(-1, 28*28))\n", + "res = res.to(device)\n", + "print(torch.argmax(output))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 283 + }, + "id": "GMf65cgLdlfa", + "outputId": "422c46d3-526c-402f-f7b9-cfa713d3fd72" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "tensor(6, device='cuda:0')\n" + ] + }, + { + "output_type": "display_data", + "data": { + "image/png": "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\n", + "text/plain": [ + "<Figure size 432x288 with 1 Axes>" + ] + }, + "metadata": { + "needs_background": "light" + } + } + ] + } + ] +}
\ No newline at end of file diff --git a/docs/researchML.ipynb b/docs/researchML.ipynb new file mode 100644 index 00000000..2f120447 --- /dev/null +++ b/docs/researchML.ipynb @@ -0,0 +1,1953 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "researchML.ipynb", + "provenance": [], + "collapsed_sections": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "7aaf00f20d77493fadb2b6ad0b96cf74": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HBoxView", + "_dom_classes": [], + "_model_name": "HBoxModel", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.5.0", + "box_style": "", + "layout": "IPY_MODEL_4b92939e2d45451da2334595d97bd68d", + "_model_module": "@jupyter-widgets/controls", + "children": [ + "IPY_MODEL_12969beb96f7497181f7167e39c40bd0", + "IPY_MODEL_74a47efac60c4af396b9d1e1f282827f", + "IPY_MODEL_3d1920917c9947148a40db3bc30a4132" + ] + } + }, + "4b92939e2d45451da2334595d97bd68d": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "12969beb96f7497181f7167e39c40bd0": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_d3ab8f1573e54fb49837c7675c8a237e", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": "", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_b84a67505e3c4030a3839cbe0b5a2d6d" + } + }, + "74a47efac60c4af396b9d1e1f282827f": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "ProgressView", + "style": "IPY_MODEL_9fa408a5efc84e64be85faca9e0701b4", + "_dom_classes": [], + "description": "", + "_model_name": "FloatProgressModel", + "bar_style": "success", + "max": 9912422, + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": 9912422, + "_view_count": null, + "_view_module_version": "1.5.0", + "orientation": "horizontal", + "min": 0, + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_3041321e29fc4fab892a3e6b3b5c9bbd" + } + }, + "3d1920917c9947148a40db3bc30a4132": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_3ebefec2c2aa499a96c4644d7855cd7d", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": " 9913344/? [00:00<00:00, 23815934.67it/s]", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_2fe247e330224176a25f48abca95cda2" + } + }, + "d3ab8f1573e54fb49837c7675c8a237e": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "b84a67505e3c4030a3839cbe0b5a2d6d": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "9fa408a5efc84e64be85faca9e0701b4": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "ProgressStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "bar_color": null, + "_model_module": "@jupyter-widgets/controls" + } + }, + "3041321e29fc4fab892a3e6b3b5c9bbd": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "3ebefec2c2aa499a96c4644d7855cd7d": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "2fe247e330224176a25f48abca95cda2": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "526a499287d146c7b3c429d3460c6736": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HBoxView", + "_dom_classes": [], + "_model_name": "HBoxModel", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.5.0", + "box_style": "", + "layout": "IPY_MODEL_692b9b0b9f16464eb0426266b5123a9c", + "_model_module": "@jupyter-widgets/controls", + "children": [ + "IPY_MODEL_cc94aeb409fd4393815cb855d952af12", + "IPY_MODEL_cef5db1a425b481ab21d898a22a73763", + "IPY_MODEL_13c1cd14c03248559d8b5a604269d800" + ] + } + }, + "692b9b0b9f16464eb0426266b5123a9c": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "cc94aeb409fd4393815cb855d952af12": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_bf19654df95e43289ed8071ad717045c", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": "", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_0597828f149d4901ba240137e35c5bf8" + } + }, + "cef5db1a425b481ab21d898a22a73763": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "ProgressView", + "style": "IPY_MODEL_bd60eec9f2314e96ae5bde2cc2b5bd90", + "_dom_classes": [], + "description": "", + "_model_name": "FloatProgressModel", + "bar_style": "success", + "max": 28881, + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": 28881, + "_view_count": null, + "_view_module_version": "1.5.0", + "orientation": "horizontal", + "min": 0, + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_0daf5c329df64e39b169cc136ceafcfd" + } + }, + "13c1cd14c03248559d8b5a604269d800": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_6b03227602be48588c11acd7c06e599f", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": " 29696/? [00:00<00:00, 409622.95it/s]", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_2efd7ec451034ab8be703274233277ce" + } + }, + "bf19654df95e43289ed8071ad717045c": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "0597828f149d4901ba240137e35c5bf8": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "bd60eec9f2314e96ae5bde2cc2b5bd90": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "ProgressStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "bar_color": null, + "_model_module": "@jupyter-widgets/controls" + } + }, + "0daf5c329df64e39b169cc136ceafcfd": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "6b03227602be48588c11acd7c06e599f": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "2efd7ec451034ab8be703274233277ce": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "b5eae176555e47b582757cd8543969d1": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HBoxView", + "_dom_classes": [], + "_model_name": "HBoxModel", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.5.0", + "box_style": "", + "layout": "IPY_MODEL_73209e9211ac4b929f3c112500ebed41", + "_model_module": "@jupyter-widgets/controls", + "children": [ + "IPY_MODEL_752919f2449647039640f2b0cd2a1e40", + "IPY_MODEL_8e577096756c42fdb6d2d0aafc080610", + "IPY_MODEL_3c56e65e3c8c4bde81f72adc6eca04ce" + ] + } + }, + "73209e9211ac4b929f3c112500ebed41": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "752919f2449647039640f2b0cd2a1e40": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_66b17d032f8741bbb482737603af5a15", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": "", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_f3938db95eee4a218798a65ed2a9ec5d" + } + }, + "8e577096756c42fdb6d2d0aafc080610": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "ProgressView", + "style": "IPY_MODEL_b2a53beffd864607b83f9e21662f1aec", + "_dom_classes": [], + "description": "", + "_model_name": "FloatProgressModel", + "bar_style": "success", + "max": 1648877, + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": 1648877, + "_view_count": null, + "_view_module_version": "1.5.0", + "orientation": "horizontal", + "min": 0, + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_0280a38e8c6e4414b6fcde5e5f23b4f2" + } + }, + "3c56e65e3c8c4bde81f72adc6eca04ce": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_856cc2055cce4a61be024950840a9e43", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": " 1649664/? [00:00<00:00, 3605986.00it/s]", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_c75692c664d04f19990180f3aab5ba5f" + } + }, + "66b17d032f8741bbb482737603af5a15": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "f3938db95eee4a218798a65ed2a9ec5d": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "b2a53beffd864607b83f9e21662f1aec": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "ProgressStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "bar_color": null, + "_model_module": "@jupyter-widgets/controls" + } + }, + "0280a38e8c6e4414b6fcde5e5f23b4f2": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "856cc2055cce4a61be024950840a9e43": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "c75692c664d04f19990180f3aab5ba5f": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "e599af99f6cc4feeb0f3f20b61d59fc0": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HBoxView", + "_dom_classes": [], + "_model_name": "HBoxModel", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.5.0", + "box_style": "", + "layout": "IPY_MODEL_06a8f00a70e44ffaafa9e8d6c851020e", + "_model_module": "@jupyter-widgets/controls", + "children": [ + "IPY_MODEL_b457e56a4a4a45578b0ab348b2be3a41", + "IPY_MODEL_c7cb67769284415b99735bb819bb575b", + "IPY_MODEL_2b926da18fd247b294fab2bf5c352238" + ] + } + }, + "06a8f00a70e44ffaafa9e8d6c851020e": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "b457e56a4a4a45578b0ab348b2be3a41": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_55aa50982905491eaa854d26cd7e79c9", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": "", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_cf701b836c794ddea46ba7242fe7125e" + } + }, + "c7cb67769284415b99735bb819bb575b": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "ProgressView", + "style": "IPY_MODEL_630ce4632ce346d5a24fc7e619fc8c4e", + "_dom_classes": [], + "description": "", + "_model_name": "FloatProgressModel", + "bar_style": "success", + "max": 4542, + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": 4542, + "_view_count": null, + "_view_module_version": "1.5.0", + "orientation": "horizontal", + "min": 0, + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_31fc6a8e3e8f42c08be70f8a8d6f72b3" + } + }, + "2b926da18fd247b294fab2bf5c352238": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_fb030304a11345a4a88f618281ac1508", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": " 5120/? [00:00<00:00, 5472.09it/s]", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_36f61cfa17944f54b74701c57e12b526" + } + }, + "55aa50982905491eaa854d26cd7e79c9": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "cf701b836c794ddea46ba7242fe7125e": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "630ce4632ce346d5a24fc7e619fc8c4e": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "ProgressStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "bar_color": null, + "_model_module": "@jupyter-widgets/controls" + } + }, + "31fc6a8e3e8f42c08be70f8a8d6f72b3": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "fb030304a11345a4a88f618281ac1508": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "36f61cfa17944f54b74701c57e12b526": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + } + } + } + }, + "cells": [ + { + "cell_type": "markdown", + "source": [ + "#TensorFlow vs PyTorch" + ], + "metadata": { + "id": "vQG0yG7VjgGE" + } + }, + { + "cell_type": "markdown", + "source": [ + "Dve najpopularnije biblioteke deep-learning-a zasnovane na Python-u su PyTorch i TensorFlow. Početniku koji se bavi mašinskim učenjem može biti teško da odluči koju od ove dve biblioteke će koristiti kada radi sa modelom deep-learning-a. Razliku je najbolje uočiti tako što će biti kreiran klasifikator koji koristi oba framework-a za rešavanje istog problema." + ], + "metadata": { + "id": "5wnwB9o0gs2L" + } + }, + { + "cell_type": "markdown", + "source": [ + "MNIST je akronim za skup podataka The Modified National Institute of Standards and Technology. To je kolekcija od 60.000 malih kvadratnih slika u nijansama sive boje pisanih cifara (od 0 do 9). Cilj je klasifikovati sliku koja je pisana rukom u jednu od deset klasa koje predstavljaju celobrojne vrednosti u rasponu od 0 do 9." + ], + "metadata": { + "id": "HLVo2_kPi0Sg" + } + }, + { + "cell_type": "markdown", + "source": [ + "## Ukratko o TensorFlow-u" + ], + "metadata": { + "id": "O9uIKVoGkG1b" + } + }, + { + "cell_type": "markdown", + "source": [ + "Google je razvio TensorFlow, koji je open source od 2015. godine. Razvio se iz Google-ovog internog softvera za mašinsko učenje, koji je refaktorisan i optimizovan za upotrebu u proizvodnji.\n", + "\n", + "Termin \"TensorFlow\" se odnosi na način na koji su podaci organizovani i obrađeni. Tenzor je najosnovnija struktura podataka u TensorFlow-u i PyTorch-u.\n", + "\n", + "TensorFlow je biblioteka za deep learning visokih performansi." + ], + "metadata": { + "id": "Hu-RncH-kKgz" + } + }, + { + "cell_type": "markdown", + "source": [ + "## Ukratko o PyTorch-u" + ], + "metadata": { + "id": "kk_iv5_Pxt5o" + } + }, + { + "cell_type": "markdown", + "source": [ + "PyTorch je jedan od najnovijih framework-a za deep learning, koji je razvio Facebook tim i objavljen na GitHub-u 2017. PyTorch dobija na popularnosti zbog svoje lakoće korišćenja, jednostavnosti i efikasnog korišćenja memorije. To je imperativ, što znači da se pokreće odmah, a korisnik može da ga testira da vidi da li radi pre nego što napiše ceo kod.\n", + "\n", + "Možemo napisati deo koda i pokrenuti ga u realnom vremenu jer ima ugrađenu Python implementaciju koja obezbeđuje kompatibilnost kao platforma za deep learning. Brzo je stekao popularnost zbog svog korisničkog interfejsa, što je navelo Tensorflow tim da ugradi svoje najpopularnije feature-e u Tensorflow 2.0." + ], + "metadata": { + "id": "y_zQUFxdx7XH" + } + }, + { + "cell_type": "markdown", + "source": [ + "## Pravljenje deep learning modela za klasifikaciju slika" + ], + "metadata": { + "id": "cJpjDu_Vy33y" + } + }, + { + "cell_type": "markdown", + "source": [ + "U daljem tekstu ćemo uporediti upotrebljivost koda i lakoću upotrebe TensorFlow-a i PyTorch-a na najčešće korišćenom skupu podataka MNIST za klasifikaciju rukom pisanih cifara. Koristeći oba okvira, proverićemo minimalne procedure koje treba sprovesti kako bismo imali odgovarajući model klasifikacije. U oba koraka modela koje treba preduzeti su učitavanje podataka, prethodna obrada, pravljenje modela, obuka i vizuelizacija rezultata. Za oba modela slojevi i konfiguracije hiperparametara su isti.\n", + "\n", + "Počećemo prvo sa TensorFlow-om." + ], + "metadata": { + "id": "0ayWMoHuzIuQ" + } + }, + { + "cell_type": "markdown", + "source": [ + "####TensorFlow - Model building" + ], + "metadata": { + "id": "_vMOqp_Zjsv4" + } + }, + { + "cell_type": "markdown", + "source": [ + "Pravimo model konvolucione neuronske mreže za klasifikaciju slika u TensorFlow-u." + ], + "metadata": { + "id": "UM6BB4oj88C3" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "hwAWAPoMjQhN" + }, + "outputs": [], + "source": [ + "import tensorflow as tf\n", + "from tensorflow.keras.datasets import mnist \n", + "from tensorflow.keras.utils import to_categorical\n", + "from tensorflow.keras.layers import Conv2D, Flatten, Dense, MaxPooling2D\n", + "from tensorflow.keras.models import Sequential\n", + "import matplotlib.pyplot as plt" + ] + }, + { + "cell_type": "markdown", + "source": [ + "Proveravamo verziju TensorFlow-a." + ], + "metadata": { + "id": "W9qjmDOX9WJM" + } + }, + { + "cell_type": "code", + "source": [ + "#pip install --upgrade tensorflow\n", + "print(tensorflow.__version__)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "X0sojNoGlLJh", + "outputId": "9971bca4-15b5-4cef-b7b6-bb380c8523fe" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "2.8.0\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "Učitavamo skup podataka mnist i pravimo training i test skupove:" + ], + "metadata": { + "id": "o1VR27929iWZ" + } + }, + { + "cell_type": "code", + "source": [ + "mnist = tf.keras.datasets.mnist\n", + "(x_train, y_train),(x_test, y_test) = mnist.load_data()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Yk04SZJXsTeZ", + "outputId": "1f88f77e-fa4d-4238-b4a9-98deb2242f74" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz\n", + "11493376/11490434 [==============================] - 0s 0us/step\n", + "11501568/11490434 [==============================] - 0s 0us/step\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "Takođe je neophodno da se srede ulazni podaci." + ], + "metadata": { + "id": "Tei7ILqu9t_O" + } + }, + { + "cell_type": "code", + "source": [ + "# reshaping and one hot encoding\n", + "x_train = x_train.reshape(x_train.shape[0], 28, 28, 1)\n", + "x_test = x_test.reshape(x_test.shape[0], 28, 28, 1)\n", + "y_train = to_categorical(y_train)\n", + "y_test = to_categorical(y_test)" + ], + "metadata": { + "id": "vxC2d4mfsez3" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# scaling\n", + "x_train = x_train.astype('float32')\n", + "x_test = x_test.astype('float32')\n", + "x_train = x_train / 255.0\n", + "x_test = x_test / 255.0" + ], + "metadata": { + "id": "fVHrrpMIsgTY" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "model = Sequential()\n", + "model.add(Conv2D(32, (3,3), input_shape = (28,28,1), activation='relu'))\n", + "model.add(Conv2D(64,(3,3), activation='relu'))\n", + "model.add(MaxPooling2D((2,2)))\n", + "model.add(Flatten())\n", + "model.add(Dense(1024, activation='relu'))\n", + "model.add(Dense(10, activation='softmax'))\n", + "# compile\n", + "model.compile(optimizer='sgd', loss='categorical_crossentropy', metrics=['accuracy'])" + ], + "metadata": { + "id": "UK3Mr-QPslnC" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# training \n", + "history = model.fit(x_train, y_train, validation_split=0.3, epochs=5)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "5g4Lj3_MspM8", + "outputId": "a0dfaa33-1d5b-4a60-e210-af127cd88dc9" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Epoch 1/5\n", + "1313/1313 [==============================] - 209s 158ms/step - loss: 0.4175 - accuracy: 0.8820 - val_loss: 0.2058 - val_accuracy: 0.9382\n", + "Epoch 2/5\n", + "1313/1313 [==============================] - 209s 159ms/step - loss: 0.1549 - accuracy: 0.9522 - val_loss: 0.1585 - val_accuracy: 0.9532\n", + "Epoch 3/5\n", + "1313/1313 [==============================] - 206s 157ms/step - loss: 0.1115 - accuracy: 0.9653 - val_loss: 0.1066 - val_accuracy: 0.9688\n", + "Epoch 4/5\n", + "1313/1313 [==============================] - 206s 157ms/step - loss: 0.0881 - accuracy: 0.9725 - val_loss: 0.1051 - val_accuracy: 0.9675\n", + "Epoch 5/5\n", + "1313/1313 [==============================] - 205s 156ms/step - loss: 0.0749 - accuracy: 0.9763 - val_loss: 0.0923 - val_accuracy: 0.9718\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "#### PyTorch - Model building" + ], + "metadata": { + "id": "aqZ7Nc5TxDm3" + } + }, + { + "cell_type": "markdown", + "source": [ + "Pravimo model konvolucione neuronske mreže za klasifikaciju slika u PyTorch-u." + ], + "metadata": { + "id": "x5sFtN51-vqI" + } + }, + { + "cell_type": "code", + "source": [ + "import torch\n", + "import torch.nn as nn\n", + "import torch.optim as optim\n", + "import torch.nn.functional as F\n", + "from torchvision import datasets, transforms" + ], + "metadata": { + "id": "Al-YoL-VxHYS" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "Učitavanje i preprocesiranje podataka." + ], + "metadata": { + "id": "U9Tawkpb_umB" + } + }, + { + "cell_type": "code", + "source": [ + "# pre-processor\n", + "transform = transforms.Compose([\n", + " transforms.Resize((8, 8)),\n", + " transforms.ToTensor(),\n", + " transforms.Normalize((0.1307,), (0.3081,))])" + ], + "metadata": { + "id": "FNqQvbBrxU3s" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# load the data\n", + "train_dataset = datasets.MNIST(\n", + " 'data', train=True, download=True, transform=transform)\n", + "test_dataset = datasets.MNIST(\n", + " 'data', train=False, download=True, transform=transform)\n", + " \n", + "train_loader = torch.utils.data.DataLoader(train_dataset, batch_size=512)\n", + "test_loader = torch.utils.data.DataLoader(test_dataset, batch_size=512)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 436, + "referenced_widgets": [ + "7aaf00f20d77493fadb2b6ad0b96cf74", + "4b92939e2d45451da2334595d97bd68d", + "12969beb96f7497181f7167e39c40bd0", + "74a47efac60c4af396b9d1e1f282827f", + "3d1920917c9947148a40db3bc30a4132", + "d3ab8f1573e54fb49837c7675c8a237e", + "b84a67505e3c4030a3839cbe0b5a2d6d", + "9fa408a5efc84e64be85faca9e0701b4", + "3041321e29fc4fab892a3e6b3b5c9bbd", + "3ebefec2c2aa499a96c4644d7855cd7d", + "2fe247e330224176a25f48abca95cda2", + "526a499287d146c7b3c429d3460c6736", + "692b9b0b9f16464eb0426266b5123a9c", + "cc94aeb409fd4393815cb855d952af12", + "cef5db1a425b481ab21d898a22a73763", + "13c1cd14c03248559d8b5a604269d800", + "bf19654df95e43289ed8071ad717045c", + "0597828f149d4901ba240137e35c5bf8", + "bd60eec9f2314e96ae5bde2cc2b5bd90", + "0daf5c329df64e39b169cc136ceafcfd", + "6b03227602be48588c11acd7c06e599f", + "2efd7ec451034ab8be703274233277ce", + "b5eae176555e47b582757cd8543969d1", + "73209e9211ac4b929f3c112500ebed41", + "752919f2449647039640f2b0cd2a1e40", + "8e577096756c42fdb6d2d0aafc080610", + "3c56e65e3c8c4bde81f72adc6eca04ce", + "66b17d032f8741bbb482737603af5a15", + "f3938db95eee4a218798a65ed2a9ec5d", + "b2a53beffd864607b83f9e21662f1aec", + "0280a38e8c6e4414b6fcde5e5f23b4f2", + "856cc2055cce4a61be024950840a9e43", + "c75692c664d04f19990180f3aab5ba5f", + "e599af99f6cc4feeb0f3f20b61d59fc0", + "06a8f00a70e44ffaafa9e8d6c851020e", + "b457e56a4a4a45578b0ab348b2be3a41", + "c7cb67769284415b99735bb819bb575b", + "2b926da18fd247b294fab2bf5c352238", + "55aa50982905491eaa854d26cd7e79c9", + "cf701b836c794ddea46ba7242fe7125e", + "630ce4632ce346d5a24fc7e619fc8c4e", + "31fc6a8e3e8f42c08be70f8a8d6f72b3", + "fb030304a11345a4a88f618281ac1508", + "36f61cfa17944f54b74701c57e12b526" + ] + }, + "id": "SuSa2oifxaWN", + "outputId": "8223ab58-4a27-4bde-ba95-f6c9d78ed907" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz\n", + "Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz to data/MNIST/raw/train-images-idx3-ubyte.gz\n" + ] + }, + { + "output_type": "display_data", + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "7aaf00f20d77493fadb2b6ad0b96cf74", + "version_minor": 0, + "version_major": 2 + }, + "text/plain": [ + " 0%| | 0/9912422 [00:00<?, ?it/s]" + ] + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Extracting data/MNIST/raw/train-images-idx3-ubyte.gz to data/MNIST/raw\n", + "\n", + "Downloading http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz\n", + "Downloading http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz to data/MNIST/raw/train-labels-idx1-ubyte.gz\n" + ] + }, + { + "output_type": "display_data", + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "526a499287d146c7b3c429d3460c6736", + "version_minor": 0, + "version_major": 2 + }, + "text/plain": [ + " 0%| | 0/28881 [00:00<?, ?it/s]" + ] + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Extracting data/MNIST/raw/train-labels-idx1-ubyte.gz to data/MNIST/raw\n", + "\n", + "Downloading http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz\n", + "Downloading http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz to data/MNIST/raw/t10k-images-idx3-ubyte.gz\n" + ] + }, + { + "output_type": "display_data", + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "b5eae176555e47b582757cd8543969d1", + "version_minor": 0, + "version_major": 2 + }, + "text/plain": [ + " 0%| | 0/1648877 [00:00<?, ?it/s]" + ] + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Extracting data/MNIST/raw/t10k-images-idx3-ubyte.gz to data/MNIST/raw\n", + "\n", + "Downloading http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz\n", + "Downloading http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz to data/MNIST/raw/t10k-labels-idx1-ubyte.gz\n" + ] + }, + { + "output_type": "display_data", + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e599af99f6cc4feeb0f3f20b61d59fc0", + "version_minor": 0, + "version_major": 2 + }, + "text/plain": [ + " 0%| | 0/4542 [00:00<?, ?it/s]" + ] + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Extracting data/MNIST/raw/t10k-labels-idx1-ubyte.gz to data/MNIST/raw\n", + "\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "" + ], + "metadata": { + "id": "qhPhR1gB_2Hu" + } + }, + { + "cell_type": "code", + "source": [ + "# Build a model\n", + "class CNNModel(nn.Module):\n", + " def __init__(self):\n", + " super(CNNModel, self).__init__()\n", + " self.conv1 = nn.Conv2d(1, 32, 3, 1)\n", + " self.conv2 = nn.Conv2d(32, 64, 3, 1)\n", + " self.fc = nn.Linear(1024, 10)\n", + " \n", + " def forward(self, x):\n", + " x = F.relu(self.conv1(x))\n", + " x = F.relu(self.conv2(x))\n", + " x = F.max_pool2d(x, 1)\n", + " x = torch.flatten(x, 1)\n", + " x = self.fc(x)\n", + " output = F.log_softmax(x, dim=1)\n", + " return output" + ], + "metadata": { + "id": "khflrhn9xgZy" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "net = CNNModel()\n", + " \n", + "# compiling\n", + "optimizer = optim.SGD(net.parameters(), lr=0.01)\n", + "criterion = nn.CrossEntropyLoss()" + ], + "metadata": { + "id": "Yab4Lz95xlLR" + }, + "execution_count": null, + "outputs": [] + } + ] +}
\ No newline at end of file |