summaryrefslogtreecommitdiff
path: root/notebooks/00-scratch-pad.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'notebooks/00-scratch-pad.ipynb')
-rw-r--r--notebooks/00-scratch-pad.ipynb182
1 files changed, 26 insertions, 156 deletions
diff --git a/notebooks/00-scratch-pad.ipynb b/notebooks/00-scratch-pad.ipynb
index 5c4edde..2ade2bb 100644
--- a/notebooks/00-scratch-pad.ipynb
+++ b/notebooks/00-scratch-pad.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -30,7 +30,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -39,7 +39,7 @@
},
{
"cell_type": "code",
- "execution_count": 65,
+ "execution_count": null,
"metadata": {
"scrolled": false
},
@@ -50,168 +50,20 @@
},
{
"cell_type": "code",
- "execution_count": 68,
+ "execution_count": null,
"metadata": {
"scrolled": false
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "==========================================================================================\n",
- "Layer (type:depth-idx) Output Shape Param #\n",
- "==========================================================================================\n",
- "├─Sequential: 1-1 [-1, 32, 112, 112] --\n",
- "| └─ZeroPad2d: 2-1 [-1, 1, 225, 225] --\n",
- "| └─Conv2d: 2-2 [-1, 32, 112, 112] 288\n",
- "| └─BatchNorm2d: 2-3 [-1, 32, 112, 112] 64\n",
- "| └─Mish: 2-4 [-1, 32, 112, 112] --\n",
- "├─ModuleList: 1 [] --\n",
- "| └─MBConvBlock: 2-5 [-1, 16, 112, 112] --\n",
- "| | └─Sequential: 3-1 [-1, 32, 112, 112] 352\n",
- "| | └─Sequential: 3-2 [-1, 32, 112, 112] 552\n",
- "| | └─Sequential: 3-3 [-1, 16, 112, 112] 544\n",
- "| └─MBConvBlock: 2-6 [-1, 24, 56, 56] --\n",
- "| | └─Sequential: 3-4 [-1, 96, 112, 112] 1,728\n",
- "| | └─Sequential: 3-5 [-1, 96, 56, 56] 1,056\n",
- "| | └─Sequential: 3-6 [-1, 96, 56, 56] 4,728\n",
- "| | └─Sequential: 3-7 [-1, 24, 56, 56] 2,352\n",
- "| └─MBConvBlock: 2-7 [-1, 24, 56, 56] --\n",
- "| | └─Sequential: 3-8 [-1, 144, 56, 56] 3,744\n",
- "| | └─Sequential: 3-9 [-1, 144, 56, 56] 1,584\n",
- "| | └─Sequential: 3-10 [-1, 144, 56, 56] 10,548\n",
- "| | └─Sequential: 3-11 [-1, 24, 56, 56] 3,504\n",
- "| └─MBConvBlock: 2-8 [-1, 40, 28, 28] --\n",
- "| | └─Sequential: 3-12 [-1, 144, 56, 56] 3,744\n",
- "| | └─Sequential: 3-13 [-1, 144, 28, 28] 3,888\n",
- "| | └─Sequential: 3-14 [-1, 144, 28, 28] 10,548\n",
- "| | └─Sequential: 3-15 [-1, 40, 28, 28] 5,840\n",
- "| └─MBConvBlock: 2-9 [-1, 40, 28, 28] --\n",
- "| | └─Sequential: 3-16 [-1, 240, 28, 28] 10,080\n",
- "| | └─Sequential: 3-17 [-1, 240, 28, 28] 6,480\n",
- "| | └─Sequential: 3-18 [-1, 240, 28, 28] 29,100\n",
- "| | └─Sequential: 3-19 [-1, 40, 28, 28] 9,680\n",
- "| └─MBConvBlock: 2-10 [-1, 80, 14, 14] --\n",
- "| | └─Sequential: 3-20 [-1, 240, 28, 28] 10,080\n",
- "| | └─Sequential: 3-21 [-1, 240, 14, 14] 2,640\n",
- "| | └─Sequential: 3-22 [-1, 240, 14, 14] 29,100\n",
- "| | └─Sequential: 3-23 [-1, 80, 14, 14] 19,360\n",
- "| └─MBConvBlock: 2-11 [-1, 80, 14, 14] --\n",
- "| | └─Sequential: 3-24 [-1, 480, 14, 14] 39,360\n",
- "| | └─Sequential: 3-25 [-1, 480, 14, 14] 5,280\n",
- "| | └─Sequential: 3-26 [-1, 480, 14, 14] 115,800\n",
- "| | └─Sequential: 3-27 [-1, 80, 14, 14] 38,560\n",
- "| └─MBConvBlock: 2-12 [-1, 80, 14, 14] --\n",
- "| | └─Sequential: 3-28 [-1, 480, 14, 14] 39,360\n",
- "| | └─Sequential: 3-29 [-1, 480, 14, 14] 5,280\n",
- "| | └─Sequential: 3-30 [-1, 480, 14, 14] 115,800\n",
- "| | └─Sequential: 3-31 [-1, 80, 14, 14] 38,560\n",
- "| └─MBConvBlock: 2-13 [-1, 112, 14, 14] --\n",
- "| | └─Sequential: 3-32 [-1, 480, 14, 14] 39,360\n",
- "| | └─Sequential: 3-33 [-1, 480, 14, 14] 12,960\n",
- "| | └─Sequential: 3-34 [-1, 480, 14, 14] 115,800\n",
- "| | └─Sequential: 3-35 [-1, 112, 14, 14] 53,984\n",
- "| └─MBConvBlock: 2-14 [-1, 112, 14, 14] --\n",
- "| | └─Sequential: 3-36 [-1, 672, 14, 14] 76,608\n",
- "| | └─Sequential: 3-37 [-1, 672, 14, 14] 18,144\n",
- "| | └─Sequential: 3-38 [-1, 672, 14, 14] 226,632\n",
- "| | └─Sequential: 3-39 [-1, 112, 14, 14] 75,488\n",
- "| └─MBConvBlock: 2-15 [-1, 112, 14, 14] --\n",
- "| | └─Sequential: 3-40 [-1, 672, 14, 14] 76,608\n",
- "| | └─Sequential: 3-41 [-1, 672, 14, 14] 18,144\n",
- "| | └─Sequential: 3-42 [-1, 672, 14, 14] 226,632\n",
- "| | └─Sequential: 3-43 [-1, 112, 14, 14] 75,488\n",
- "| └─MBConvBlock: 2-16 [-1, 192, 7, 7] --\n",
- "| | └─Sequential: 3-44 [-1, 672, 14, 14] 76,608\n",
- "| | └─Sequential: 3-45 [-1, 672, 7, 7] 18,144\n",
- "| | └─Sequential: 3-46 [-1, 672, 7, 7] 226,632\n",
- "| | └─Sequential: 3-47 [-1, 192, 7, 7] 129,408\n",
- "| └─MBConvBlock: 2-17 [-1, 192, 7, 7] --\n",
- "| | └─Sequential: 3-48 [-1, 1152, 7, 7] 223,488\n",
- "| | └─Sequential: 3-49 [-1, 1152, 7, 7] 31,104\n",
- "| | └─Sequential: 3-50 [-1, 1152, 7, 7] 664,992\n",
- "| | └─Sequential: 3-51 [-1, 192, 7, 7] 221,568\n",
- "| └─MBConvBlock: 2-18 [-1, 192, 7, 7] --\n",
- "| | └─Sequential: 3-52 [-1, 1152, 7, 7] 223,488\n",
- "| | └─Sequential: 3-53 [-1, 1152, 7, 7] 31,104\n",
- "| | └─Sequential: 3-54 [-1, 1152, 7, 7] 664,992\n",
- "| | └─Sequential: 3-55 [-1, 192, 7, 7] 221,568\n",
- "| └─MBConvBlock: 2-19 [-1, 192, 7, 7] --\n",
- "| | └─Sequential: 3-56 [-1, 1152, 7, 7] 223,488\n",
- "| | └─Sequential: 3-57 [-1, 1152, 7, 7] 31,104\n",
- "| | └─Sequential: 3-58 [-1, 1152, 7, 7] 664,992\n",
- "| | └─Sequential: 3-59 [-1, 192, 7, 7] 221,568\n",
- "| └─MBConvBlock: 2-20 [-1, 320, 7, 7] --\n",
- "| | └─Sequential: 3-60 [-1, 1152, 7, 7] 223,488\n",
- "| | └─Sequential: 3-61 [-1, 1152, 7, 7] 12,672\n",
- "| | └─Sequential: 3-62 [-1, 1152, 7, 7] 664,992\n",
- "| | └─Sequential: 3-63 [-1, 320, 7, 7] 369,280\n",
- "├─Sequential: 1-2 [-1, 1280, 7, 7] --\n",
- "| └─Conv2d: 2-21 [-1, 1280, 7, 7] 409,600\n",
- "| └─BatchNorm2d: 2-22 [-1, 1280, 7, 7] 2,560\n",
- "==========================================================================================\n",
- "Total params: 7,142,272\n",
- "Trainable params: 7,142,272\n",
- "Non-trainable params: 0\n",
- "Total mult-adds (M): 777.62\n",
- "==========================================================================================\n",
- "Input size (MB): 0.19\n",
- "Forward/backward pass size (MB): 124.81\n",
- "Params size (MB): 27.25\n",
- "Estimated Total Size (MB): 152.24\n",
- "==========================================================================================\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"summary(en, (1, 224, 224));"
]
},
{
"cell_type": "code",
- "execution_count": 54,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "(2, 2)"
- ]
- },
- "execution_count": 54,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "(2,) * 2"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/home/aktersnurra/.cache/pypoetry/virtualenvs/text-recognizer-ejNaVa9M-py3.9/lib/python3.9/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:115.)\n",
- " return torch._C._cuda_getDeviceCount() > 0\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "False"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"torch.cuda.is_available()"
]
@@ -286,7 +138,25 @@
"metadata": {},
"outputs": [],
"source": [
- "t = torch.randn(4, 1, 576, 640).cuda()"
+ "t = torch.randn(8, 1, 576, 640).cuda()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "en.cuda()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "en(t)"
]
},
{