diff --git a/TD2 Deep Learning.ipynb b/TD2 Deep Learning.ipynb index 2ecfce959ae6b947b633a758433f9bea0bf6992e..19e9ba08ad82d2509bc344b4ec579e8013788a87 100644 --- a/TD2 Deep Learning.ipynb +++ b/TD2 Deep Learning.ipynb @@ -33,10 +33,83 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "330a42f5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting torchNote: you may need to restart the kernel to use updated packages.\n", + "\n", + " Downloading torch-2.1.0-cp311-cp311-win_amd64.whl (192.3 MB)\n", + " -------------------------------------- 192.3/192.3 MB 2.7 MB/s eta 0:00:00\n", + "Collecting torchvision\n", + " Downloading torchvision-0.16.0-cp311-cp311-win_amd64.whl (1.3 MB)\n", + " ---------------------------------------- 1.3/1.3 MB 5.0 MB/s eta 0:00:00\n", + "Collecting filelock\n", + " Downloading filelock-3.13.1-py3-none-any.whl (11 kB)\n", + "Collecting typing-extensions\n", + " Downloading typing_extensions-4.8.0-py3-none-any.whl (31 kB)\n", + "Collecting sympy\n", + " Downloading sympy-1.12-py3-none-any.whl (5.7 MB)\n", + " ---------------------------------------- 5.7/5.7 MB 5.3 MB/s eta 0:00:00\n", + "Collecting networkx\n", + " Downloading networkx-3.2.1-py3-none-any.whl (1.6 MB)\n", + " ---------------------------------------- 1.6/1.6 MB 11.7 MB/s eta 0:00:00\n", + "Collecting jinja2\n", + " Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)\n", + "Collecting fsspec\n", + " Downloading fsspec-2023.10.0-py3-none-any.whl (166 kB)\n", + " -------------------------------------- 166.4/166.4 kB 5.0 MB/s eta 0:00:00\n", + "Collecting numpy\n", + " Downloading numpy-1.26.1-cp311-cp311-win_amd64.whl (15.8 MB)\n", + " --------------------------------------- 15.8/15.8 MB 10.4 MB/s eta 0:00:00\n", + "Collecting requests\n", + " Downloading requests-2.31.0-py3-none-any.whl (62 kB)\n", + " ---------------------------------------- 62.6/62.6 kB 3.3 MB/s eta 0:00:00\n", + "Collecting pillow!=8.3.*,>=5.3.0\n", + " Downloading Pillow-10.1.0-cp311-cp311-win_amd64.whl (2.6 MB)\n", + " ---------------------------------------- 2.6/2.6 MB 10.4 MB/s eta 0:00:00\n", + "Collecting MarkupSafe>=2.0\n", + " Downloading MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl (17 kB)\n", + "Collecting charset-normalizer<4,>=2\n", + " Downloading charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl (99 kB)\n", + " ---------------------------------------- 99.9/99.9 kB ? eta 0:00:00\n", + "Collecting idna<4,>=2.5\n", + " Using cached idna-3.4-py3-none-any.whl (61 kB)\n", + "Collecting urllib3<3,>=1.21.1\n", + " Downloading urllib3-2.0.7-py3-none-any.whl (124 kB)\n", + " -------------------------------------- 124.2/124.2 kB 7.1 MB/s eta 0:00:00\n", + "Collecting certifi>=2017.4.17\n", + " Downloading certifi-2023.7.22-py3-none-any.whl (158 kB)\n", + " -------------------------------------- 158.3/158.3 kB 9.3 MB/s eta 0:00:00\n", + "Collecting mpmath>=0.19\n", + " Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)\n", + " -------------------------------------- 536.2/536.2 kB 8.5 MB/s eta 0:00:00\n", + "Installing collected packages: mpmath, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, fsspec, filelock, charset-normalizer, certifi, requests, jinja2, torch, torchvision\n", + "Successfully installed MarkupSafe-2.1.3 certifi-2023.7.22 charset-normalizer-3.3.2 filelock-3.13.1 fsspec-2023.10.0 idna-3.4 jinja2-3.1.2 mpmath-1.3.0 networkx-3.2.1 numpy-1.26.1 pillow-10.1.0 requests-2.31.0 sympy-1.12 torch-2.1.0 torchvision-0.16.0 typing-extensions-4.8.0 urllib3-2.0.7\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " WARNING: The script isympy.exe is installed in 'c:\\Users\\oscar\\AppData\\Local\\Programs\\Python\\Python311\\Scripts' which is not on PATH.\n", + " Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.\n", + " WARNING: The script f2py.exe is installed in 'c:\\Users\\oscar\\AppData\\Local\\Programs\\Python\\Python311\\Scripts' which is not on PATH.\n", + " Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.\n", + " WARNING: The script normalizer.exe is installed in 'c:\\Users\\oscar\\AppData\\Local\\Programs\\Python\\Python311\\Scripts' which is not on PATH.\n", + " Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.\n", + " WARNING: The scripts convert-caffe2-to-onnx.exe, convert-onnx-to-caffe2.exe and torchrun.exe are installed in 'c:\\Users\\oscar\\AppData\\Local\\Programs\\Python\\Python311\\Scripts' which is not on PATH.\n", + " Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.\n", + "\n", + "[notice] A new release of pip available: 22.3.1 -> 23.3.1\n", + "[notice] To update, run: python.exe -m pip install --upgrade pip\n" + ] + } + ], "source": [ "%pip install torch torchvision" ] @@ -52,10 +125,72 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "b1950f0a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "tensor([[ 0.0623, -0.0446, 0.5663, 0.3230, -0.7409, -0.1572, 0.8963, -0.4770,\n", + " -1.2816, 0.5079],\n", + " [ 0.3733, 1.0840, 1.0617, 1.6714, -1.7589, -0.1724, -1.4693, -1.1851,\n", + " 0.0491, 0.6016],\n", + " [ 0.1125, -0.0759, -1.5118, 0.3206, -1.1785, 2.1170, 0.8670, -0.1329,\n", + " 0.2162, 0.1233],\n", + " [ 0.4477, 1.0772, -0.4995, -0.2830, 0.5112, -0.3607, 0.6988, 0.1817,\n", + " 1.3802, 0.5527],\n", + " [ 1.3525, 0.4180, -0.9762, 1.0007, 0.5814, 1.6451, -0.1181, -0.4325,\n", + " 1.0645, -0.5795],\n", + " [ 1.0887, 0.7277, -3.0639, -1.2307, -0.1011, 0.7421, -1.3683, -0.8422,\n", + " 0.7951, -1.3425],\n", + " [ 1.5040, -1.2050, 0.0102, 0.2307, 1.4635, -0.4888, 0.2364, 0.3678,\n", + " 0.6687, 0.8214],\n", + " [ 1.9257, 0.0810, 0.3342, -0.3089, 0.7999, 0.2292, -1.2464, 2.3484,\n", + " -0.4570, -1.1377],\n", + " [ 1.7949, -1.9770, 0.0998, 0.5153, -0.6583, -0.6373, -1.0954, -1.8278,\n", + " 1.3128, -0.1538],\n", + " [ 0.8187, -0.7936, -0.7567, 0.1686, 0.2311, -0.3796, 1.3037, -0.4960,\n", + " -0.3321, -0.1440],\n", + " [ 0.7823, -0.3177, -0.3808, 0.1615, -0.7362, -0.0447, -0.5822, 0.1760,\n", + " 0.4381, -0.0179],\n", + " [ 0.4295, 0.9099, 1.6793, -1.1323, 0.4389, 1.9163, 1.3523, -1.3593,\n", + " 0.4433, -0.6030],\n", + " [ 1.4524, -1.5130, -0.2983, -1.1823, 0.0118, 1.3023, -0.6846, 0.7628,\n", + " 0.5770, -1.6766],\n", + " [ 0.8742, -0.1214, -1.4390, 0.7520, -0.6277, 0.6274, 0.5261, 1.2921,\n", + " 1.3526, -0.6230]])\n", + "AlexNet(\n", + " (features): Sequential(\n", + " (0): Conv2d(3, 64, kernel_size=(11, 11), stride=(4, 4), padding=(2, 2))\n", + " (1): ReLU(inplace=True)\n", + " (2): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)\n", + " (3): Conv2d(64, 192, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))\n", + " (4): ReLU(inplace=True)\n", + " (5): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)\n", + " (6): Conv2d(192, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " (7): ReLU(inplace=True)\n", + " (8): Conv2d(384, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " (9): ReLU(inplace=True)\n", + " (10): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n", + " (11): ReLU(inplace=True)\n", + " (12): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)\n", + " )\n", + " (avgpool): AdaptiveAvgPool2d(output_size=(6, 6))\n", + " (classifier): Sequential(\n", + " (0): Dropout(p=0.5, inplace=False)\n", + " (1): Linear(in_features=9216, out_features=4096, bias=True)\n", + " (2): ReLU(inplace=True)\n", + " (3): Dropout(p=0.5, inplace=False)\n", + " (4): Linear(in_features=4096, out_features=4096, bias=True)\n", + " (5): ReLU(inplace=True)\n", + " (6): Linear(in_features=4096, out_features=1000, bias=True)\n", + " )\n", + ")\n" + ] + } + ], "source": [ "import torch\n", "\n", @@ -69,6 +204,15 @@ "print(alexnet)" ] }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# test" + ] + }, { "cell_type": "markdown", "id": "23f266da", @@ -940,7 +1084,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.11.3" }, "vscode": { "interpreter": {