{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "850d8c65-cf49-4c62-8d3e-7991a941f2d4",
   "metadata": {},
   "source": [
    "<figure>\n",
    "<img src=\"../Imagenes/logo-final-ap.png\"  width=\"80\" height=\"80\" align=\"left\"/> \n",
    "</figure>\n",
    "\n",
    "# <span style=\"color:blue\"><left>Aprendizaje Profundo</left></span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4d45bbdf-1e03-452a-9518-832bfb7d2c89",
   "metadata": {
    "tags": []
   },
   "source": [
    "# <span style=\"color:red\"><center>Pytorch-lightning</center></span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8e5a5d93-2fd1-4f5c-b7d3-d37508e35d94",
   "metadata": {},
   "source": [
    "<figure>\n",
    "<center>\n",
    "<img src=\"../Imagenes/Large_lightning_bolt.jpg\" width=\"800\" height=\"800\" align=\"center\"/>\n",
    "</center>\n",
    "</figure>\n",
    "\n",
    "\n",
    "Fuente: <a href=\"https://commons.wikimedia.org/wiki/File:Large_lightning_bolt.jpg\">Guilerms</a>, <a href=\"https://creativecommons.org/licenses/by-sa/4.0\">CC BY-SA 4.0</a>, via Wikimedia Commons"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9470be15-7c36-49e1-9ec2-b8650e584f05",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "## <span style=\"color:#4361EE\">Coordinador</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b35c1e2f-b3b4-46d2-af72-72771bc310a5",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "- Campo Elías Pardo, PhD, cepardot@unal.edu.co"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6afdaea4-8930-4dc0-9cc3-dc3d31f1542d",
   "metadata": {},
   "source": [
    "## <span style=\"color:#4361EE\">Profesores</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dc098b33-843d-4f75-98d7-f70610004198",
   "metadata": {},
   "source": [
    "1. Alvaro  Montenegro, PhD, ammontenegrod@unal.edu.co\n",
    "1. Camilo José Torres Jiménez, Msc, cjtorresj@unal.edu.co\n",
    "1. Daniel  Montenegro, Msc, dextronomo@gmail.com "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "af1029c8-1e06-4ef5-b992-f36cae9d4caa",
   "metadata": {},
   "source": [
    "## <span style=\"color:#4361EE\">Asesora Medios y Marketing digital</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a8339d77-9304-4388-9a8c-ae264360c301",
   "metadata": {},
   "source": [
    "1. Maria del Pilar Montenegro, pmontenegro88@gmail.com\n",
    "1. Jessica López Mejía, jelopezme@unal.edu.co\n",
    "1. Venus Celeste Puertas Gualtero, vpuertasg@unal.edu.co"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cd96f054-2fc2-4f85-b62c-c03d2c204b10",
   "metadata": {},
   "source": [
    "## <span style=\"color:#4361EE\">Jefe Jurídica</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b6222dad-4270-466b-bfa5-c31e4a0f9006",
   "metadata": {},
   "source": [
    "6. Paula Andrea Guzmán, guzmancruz.paula@gmail.com"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "714da2ce-e7ba-42e4-8925-434229ec3c1a",
   "metadata": {},
   "source": [
    "## <span style=\"color:#4361EE\">Coordinador Jurídico</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "83341e02-6fd3-449e-8495-aeacd223bc3d",
   "metadata": {},
   "source": [
    "7. David Fuentes, fuentesd065@gmail.com"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5c2f8b6f-193a-49dc-a08b-2f0c6abf7e47",
   "metadata": {},
   "source": [
    "## <span style=\"color:#4361EE\">Desarrolladores Principales</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "87c999d7-ec87-435d-812c-df5e05ac882f",
   "metadata": {},
   "source": [
    "8. Dairo Moreno, damoralesj@unal.edu.co\n",
    "9. Joan Castro, jocastroc@unal.edu.co\n",
    "10. Bryan Riveros, briveros@unal.edu.co\n",
    "11. Rosmer Vargas, rovargasc@unal.edu.co\n",
    "12. Venus Puertas, vpuertasg@unal.edu.co"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "39bcf746-2063-499d-a4a5-87064001247b",
   "metadata": {},
   "source": [
    "## <span style=\"color:#4361EE\">Expertos en Bases de Datos</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "760ac84c-d227-4b6f-9efa-6de06723f473",
   "metadata": {
    "tags": []
   },
   "source": [
    "13. Giovvani Barrera, udgiovanni@gmail.com\n",
    "14. Camilo Chitivo, cchitivo@unal.edu.co"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c95dcf83-89c8-41a2-95d2-d359876a745d",
   "metadata": {},
   "source": [
    "## <span style=\"color:blue\">Referencias</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e81f1544-61e0-41a9-bae4-480dd4fbe088",
   "metadata": {},
   "source": [
    "1. [Alvaro Montenegro y Daniel Montenegro, Inteligencia Artificial y Aprendizaje Profundo, 2023](https://github.com/AprendizajeProfundo/Diplomado)\n",
    "1. [Alvaro Montenegro, Daniel Montenegro y Oleg Jarma,  Inteligencia Artificial y Aprendizaje Profundo Avanzado, 2023](https://github.com/AprendizajeProfundo/Diplomado-Avanzado)\n",
    "1. [Tutoriales de Pytorch](https://pytorch.org/tutorials/)\n",
    "1. [Pytorchlightning.ai](https://www.pytorchlightning.ai/)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ec0961e2-f9a2-4a22-a215-15441aa3f0df",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "## <span style=\"color:blue\">Contenido</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "71e76b5f-dfa0-4ef0-8298-7537151772b5",
   "metadata": {},
   "source": [
    "* [Introducción](#Introducción)\n",
    "* [Instalar Pytorch-lightning](#Instalar-Pytorch-lightning)\n",
    "* [Ejemplo de un módulo Lightning](#Ejemplo-de-un-módulo-Lightning)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aba8e8fd-b4d2-4d44-8511-718af854d4bd",
   "metadata": {
    "tags": []
   },
   "source": [
    "## <span style=\"color:blue\">Introducción</span> "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2d026e31-2c95-4a27-9da0-45331b02c810",
   "metadata": {},
   "source": [
    "<figure>\n",
    "<center>\n",
    "<img src=\"../Imagenes/trainer.png\" width=\"800\" height=\"800\" align=\"center\"/>\n",
    "</center>\n",
    "</figure>\n",
    "\n",
    "\n",
    "Fuente: Alvaro Montenegro"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab698e08-33bf-45c2-8b16-306084b6bf78",
   "metadata": {
    "tags": []
   },
   "source": [
    "## <span style=\"color:blue\">Introducción</span> "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0e02e2c2-0e22-4f37-8e7d-021c3bad1b04",
   "metadata": {},
   "source": [
    "En esta lección aprendemos como construir una modelo de clasificación de imágenes a color. Usaremos el framework [Pytorch-lightning](https://www.pytorchlightning.ai/) para construir el modelo y el conjunto de datos [CIFAR10](https://www.cs.toronto.edu/~kriz/cifar.html). La siguiente figura los tipos de datos que se usarán en esta lección. El contenido es una adaptación libre del tutorial [Image Classification using PyTorch Lightning](https://wandb.ai/wandb/wandb-lightning/reports/Image-Classification-using-PyTorch-Lightning--VmlldzoyODk1NzY) de [WandB](https://wandb.ai/site)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f0bcd09b-7e30-47ed-b57d-d232193cb03f",
   "metadata": {},
   "source": [
    "<figure>\n",
    "<center>\n",
    "<img src=\"../Imagenes/cifar10.png\" width=\"600\" height=\"600\" align=\"center\"/>\n",
    "</center>\n",
    "</figure>\n",
    "\n",
    "\n",
    "Fuente: [Universidad de Toronto-Cifar10](https://www.cs.toronto.edu/~kriz/cifar.html)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "21048ee9-8cbe-49f6-b8f6-03261e092621",
   "metadata": {},
   "source": [
    "Para esta lección usaremos los datos CIFAR10 disponibles en los datasets de la librería [Torchvision](https://pytorch.org/vision/stable/index.html). Adicionalmente usaremos [Weights and bias-Wandb](https://wandb.ai/site), una plataforma moderna que puede apoyar para crear mejores modelos, más rápido con el seguimiento de experimentos, el control de versiones de conjuntos de datos y la gestión de modelos. WandB debe instalarse por separado, pero se incorpora a la librería `pytorch_lightning.loggers`.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "14327a65-1c99-4832-b575-49ae84437201",
   "metadata": {},
   "source": [
    "## <span style=\"color:blue\">Preparación de los datos</span> "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5962b5c6-b5b5-49fb-b7da-2ab6656c1ac0",
   "metadata": {},
   "source": [
    "Los `DataModule` son una forma de desacoplar enlaces relacionados con datos del LightningModule para que pueda desarrollar modelos agnósticos de conjuntos de datos. En otra palabras, con DataModule puede preparar los datos por fuera del módulo de entrenamiento, de tal manera que peude cambiar sus datos sin tocar el módulo de entrenamiento.\n",
    "\n",
    "Con `DataModule` podemos organiza la canalización de datos en una clase compartible y reutilizable. Un módulo de datos encapsula los cinco pasos involucrados en el procesamiento de datos en PyTorch:\n",
    "\n",
    "* Descargar/tokenizar/procesar.\n",
    "* Limpiar y (tal vez) guardar en el disco.\n",
    "* Cargar dentro del conjunto de datos.\n",
    "* Aplicar transformaciones (rotar, tokenizar, etc.).\n",
    "* Envolver dentro de un DataLoader.\n",
    "\n",
    "\n",
    "Obtenga más información sobre los módulos de datos [aquí](https://pytorch-lightning.readthedocs.io/en/latest/data/datamodule.html). Construyamos un módulo de datos para el conjunto de datos Cifar-10."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9de02b2c-3da4-429e-bd12-7b20b0640afd",
   "metadata": {
    "tags": []
   },
   "source": [
    "## <span style=\"color:blue\">Carga las librerías requeridas</span> "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cf6fa436-86f2-4db4-92a2-60250534ce69",
   "metadata": {},
   "source": [
    "Instale la libreria wandb con el siguiente comando:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "83c02d38-9fcb-49d6-ad2a-1d5d66c1f84f",
   "metadata": {},
   "outputs": [],
   "source": [
    "#!conda install -c conda-forge wandb"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ea02acc2-4c38-4778-9914-f27a297fdb1d",
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import pytorch_lightning as pl\n",
    "from torch import nn\n",
    "from torch.nn import functional as F\n",
    "\n",
    "# Carga DataLoader para crear los dataloaders\n",
    "from torch.utils.data import DataLoader, random_split\n",
    "\n",
    "# Librería Torchvision\n",
    "import torchvision\n",
    "from torchvision import transforms\n",
    "\n",
    "# métricas\n",
    "import torchmetrics \n",
    "\n",
    "# Carga WandBLogger para hacer seguimiento (tracking) del entrenamiento\n",
    "from pytorch_lightning.loggers import WandbLogger\n",
    "\n",
    "# carga el dataset CIFAR10\n",
    "import torchvision.datasets as datasets\n",
    "CIFAR10 = datasets.CIFAR10\n",
    "\n",
    "# callbacks\n",
    "from pytorch_lightning.callbacks import Callback \n",
    "from pytorch_lightning.callbacks.early_stopping import EarlyStopping\n",
    "from pytorch_lightning.callbacks import ModelCheckpoint\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7f3c9bc5-bf5d-41bc-a8b6-7d15ee9c1e24",
   "metadata": {},
   "source": [
    "### <span style=\"color:#4CC9F0\">Canalización (pipeline) de los datos con DataModule</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "47d42586-b397-470c-8ccb-41a58581ba35",
   "metadata": {},
   "source": [
    "Construimos una clase derivada de `LightningDataModule` específica para CIFAR10."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "78e554bb-eeb6-47b2-9820-883b2751fa85",
   "metadata": {},
   "outputs": [],
   "source": [
    "from torch.utils.data import DataLoader, random_split\n",
    "import torchvision.datasets as datasets\n",
    "CIFAR10 = datasets.CIFAR10\n",
    "from torchvision import transforms\n",
    "\n",
    "class CIFAR10DataModule(pl.LightningDataModule):\n",
    "    \n",
    "    def __init__(self, batch_size, data_dir: str = './', num_workers=4):\n",
    "        \"\"\"\n",
    "        Pasaremos los hiperparámetros necesarios para nuestra canalización de datos\n",
    "        También definiremos la canalización de transformación de datos aquí.\n",
    "        \"\"\"\n",
    "        super().__init__()\n",
    "        self.data_dir = data_dir\n",
    "        self.batch_size = batch_size\n",
    "        self.num_workers = num_workers\n",
    "\n",
    "        self.transform = transforms.Compose([\n",
    "            transforms.ToTensor(),\n",
    "            transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))\n",
    "        ])\n",
    "        \n",
    "        self.dims = (3, 32, 32)\n",
    "        self.num_classes = 10\n",
    "        \n",
    "        \n",
    "    def prepare_data(self):\n",
    "        \"\"\"\n",
    "        Aquí es donde definiremos la lógica para descargar nuestro conjunto de datos. \n",
    "        Estamos utilizando la clase de conjunto de datos CIFAR10 de torchvision para descargar.\n",
    "        Use este método para hacer cosas que podrían escribirse en el disco \n",
    "        o que deben hacerse solo desde una única GPU en configuraciones distribuidas. \n",
    "        No haga ninguna asignación de estado en esta función \n",
    "        (es decir, self.alguna_cosa = ...).\n",
    "        \"\"\"\n",
    "        # descarga\n",
    "        CIFAR10(self.data_dir, train=True, download=True)\n",
    "        CIFAR10(self.data_dir, train=False, download=True)\n",
    "\n",
    "    def setup(self, stage=None):\n",
    "        \"\"\"\n",
    "        Aquí es donde cargaremos los datos del archivo y prepararemos \n",
    "        los conjuntos de datos del tensor PyTorch para cada división de los datos. \n",
    "        La división de datos es por lo tanto reproducible. \n",
    "        Este método espera un argumento de etapa (stage) que se utiliza para separar \n",
    "        la lógica de 'entrenamiento' y de 'prueba'. \n",
    "        Esto es útil si no queremos cargar todo el conjunto de datos a la vez. \n",
    "        Las operaciones de datos que queremos realizar en cada GPU se definen aquí. \n",
    "        Esto incluye aplicar la transformación al conjunto de datos del tensor de PyTorch.\n",
    "        \"\"\"        \n",
    "        # Asigna datos a los datasets de entrenamiento/validación  \n",
    "        # para uso en los dataloaders\n",
    "        if stage == 'fit' or stage is None:\n",
    "            cifar_full = CIFAR10(self.data_dir, train=True, transform=self.transform)\n",
    "            self.cifar_train, self.cifar_val = random_split(cifar_full, [45000, 5000])\n",
    "\n",
    "        # Asigna dataset de prueba para uso en los  dataloader(s)\n",
    "        if stage == 'test' or stage is None:\n",
    "            self.cifar_test = CIFAR10(self.data_dir, train=False, transform=self.transform)\n",
    "\n",
    "    # Métodos para crear los dataloaders        \n",
    "    def train_dataloader(self):\n",
    "        return DataLoader(self.cifar_train, batch_size=self.batch_size, shuffle=True, num_workers=self.num_workers)\n",
    "\n",
    "\n",
    "    def val_dataloader(self):\n",
    "        return DataLoader(self.cifar_val, batch_size=self.batch_size, num_workers=self.num_workers)\n",
    "\n",
    "\n",
    "    def test_dataloader(self):\n",
    "        return DataLoader(self.cifar_test, batch_size=self.batch_size, num_workers=self.num_workers)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d2ded3e1-3cf2-4f1e-88a4-def6bbf41d45",
   "metadata": {
    "tags": []
   },
   "source": [
    "## <span style=\"color:blue\">Devolución de llamadas (Callbacks)</span> "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "31bfeab5-2add-46f5-913e-e56b3c479883",
   "metadata": {},
   "source": [
    "Una devolución de llamada o `callback` es un programa autónomo que se puede reutilizar en todos los proyectos. PyTorch Lightning viene con algunos callbacks integrados que se usan regularmente.\n",
    "Obtenga más información sobre callbacks en PyTorch Lightning [aquí](https://pytorch-lightning.readthedocs.io/en/latest/extensions/callbacks.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a454fe0c-98d7-4d59-b0ab-b590c20b6344",
   "metadata": {},
   "source": [
    "### <span style=\"color:#4CC9F0\">Devoluciones  de llamada integrados</span> "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6e9a219f-6c4d-457e-b826-304cb432d4c1",
   "metadata": {},
   "source": [
    "En este tutorial, utilizaremos las devoluciones de llamada integradas de parada anticipada `Early Stopping` y punto de control `checkpoint` de modelo. Estos callback se pueden pasar al entrenador (`Trainer`)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c37c264f-39f7-4c9e-bdfb-4c5054d4b5b4",
   "metadata": {},
   "source": [
    "### <span style=\"color:#4CC9F0\">Devoluciones de llamada personalizados</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "427d48f6-0cce-4817-b1d4-d2a79bf88936",
   "metadata": {},
   "source": [
    "Si está familiarizado con la devolución de llamada personalizada de `Keras`, la capacidad de hacer lo mismo en su canalización de PyTorch es solo una cereza del pastel.\n",
    "\n",
    "Dado que estamos realizando una clasificación de imágenes, la capacidad de visualizar las predicciones del modelo en algunas muestras de imágenes puede resultar útil. Esto en forma de callback puede ayudar a depurar el modelo en una etapa temprana. Así que vamos a implementar un callback personalizado para tal fin."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bfb3942a-b103-4171-ac33-809695545fb7",
   "metadata": {},
   "source": [
    "## <span style=\"color:blue\">LightningModule - Definición del sistema</span> "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "51ea586c-1687-4d56-8d45-1e7057049bd3",
   "metadata": {},
   "source": [
    "`LightningModule` define un sistema y no un modelo. Aquí, un sistema agrupa todo el código de investigación en una sola clase para que sea autónomo. LightningModule organiza su código PyTorch en 5 secciones:\n",
    "\n",
    "* Bucle de entranamiento (training_step)\n",
    "* Bucle de validación (validation_step)\n",
    "* Bucle de prueba (test_step)\n",
    "* Optimizadores (configure_optimizers)\n",
    "\n",
    "\n",
    "Por lo tanto, se puede construir un modelo agnóstico del conjunto de datos que se puede compartir fácilmente. Construyamos un sistema para la clasificación Cifar-10.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4c8d5a6b-1c04-47e1-952a-ac6378e428dd",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "class LitModel(pl.LightningModule):\n",
    "    def __init__(self,  backbone,  learning_rate=2e-4, ):\n",
    "        super().__init__()\n",
    "        # activa log para almacenar los hiperparámetros\n",
    "        self.save_hyperparameters()\n",
    "        # modelo\n",
    "        self.backbone = backbone\n",
    "        # rata  de aprendizaje para el optimizador\n",
    "        self.learning_rate = learning_rate\n",
    "        # métricas\n",
    "        self.train_acc = torchmetrics.Accuracy(task=\"multiclass\", num_classes=10)\n",
    "        self.valid_acc = torchmetrics.Accuracy(task=\"multiclass\", num_classes=10)\n",
    "        self.test_acc = torchmetrics.Accuracy(task=\"multiclass\", num_classes=10)\n",
    "            \n",
    "    def training_step(self, batch, batch_idx):\n",
    "        \"\"\"\n",
    "        Lightning automatiza la mayor parte del entrenamiento para nosotros, \n",
    "        la época y las iteraciones por lotes, todo lo que necesitamos mantener \n",
    "        es la lógica del paso de entrenamiento. El método training_step requiere argumentos \n",
    "        batch y batch_idx que el Entrenador pasa automáticamente. \n",
    "        \"\"\"\n",
    "        x, y = batch\n",
    "        logits = self.backbone(x)\n",
    "        loss = F.nll_loss(logits, y) # entropía cruzada: negative log likelihood\n",
    "        \n",
    "        # training metrics\n",
    "        preds = torch.argmax(logits, dim=1)\n",
    "        acc = self.train_acc(preds, y)\n",
    "        #self.log('perdida_entrenamiento', loss )\n",
    "        #self.log('precision_entrenamiento', acc)\n",
    "        wandb.log({\"acc_train\": acc, \"loss_train\": loss})\n",
    "        return loss\n",
    "\n",
    "    def validation_step(self, batch, batch_idx):\n",
    "        \"\"\"\n",
    "        el ciclo de validación se puede implementar sobrescribiendo este método \n",
    "        de LightningModule\n",
    "        \"\"\"\n",
    "        x, y = batch\n",
    "        logits = self.backbone(x)\n",
    "        loss = F.nll_loss(logits, y)\n",
    "\n",
    "        # validation metrics\n",
    "        preds = torch.argmax(logits, dim=1)\n",
    "        acc = self.valid_acc(preds, y)\n",
    "        #self.log('perdida_validacion', loss, prog_bar=True)\n",
    "        #self.log('precision_validacion', acc, prog_bar=True)\n",
    "        wandb.log({\"acc_test\": acc, \"loss_test\": loss})\n",
    "        return loss\n",
    "\n",
    "    def test_step(self, batch, batch_idx):\n",
    "        \"\"\"\n",
    "        Este método similar al ciclo de validación. \n",
    "        La única diferencia es que en prueba solo se llama \n",
    "        cuando se usa trainer.test(). \n",
    "        Las métricas se registran automáticamente por épocas.\n",
    "        \"\"\"\n",
    "        x, y = batch\n",
    "        logits = self.backbone(x)\n",
    "        loss = F.nll_loss(logits, y)\n",
    "        \n",
    "        # validation metrics\n",
    "        preds = torch.argmax(logits, dim=1)\n",
    "        acc = self.test_acc(preds, y)\n",
    "        #self.log('perdida_test', loss, prog_bar=True)\n",
    "        #self.log('precision_test', acc, prog_bar=True)\n",
    "        wandb.log({\"acc_test\": acc, \"loss_test\": loss})\n",
    "        return loss\n",
    "    \n",
    "    def configure_optimizers(self):\n",
    "        \"\"\"\n",
    "        Podemos definir nuestro optimizador y programadores \n",
    "        de tasa de aprendizaje usando el método \n",
    "        configure_optimizer. \n",
    "        Incluso se pueden definir múltiples optimizadores \n",
    "        como en el caso de las GAN.\n",
    "        \"\"\"\n",
    "        optimizer = torch.optim.Adam(self.backbone.parameters(), lr=self.learning_rate)\n",
    "        return optimizer\n",
    "    \n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "418c3ed0-d909-42b6-8e71-73e094ef4142",
   "metadata": {},
   "outputs": [],
   "source": [
    "class LitModel(pl.LightningModule):\n",
    "    def __init__(self, input_shape, num_classes, learning_rate=2e-4):\n",
    "        super().__init__()\n",
    "        \n",
    "        # log hyperparameters\n",
    "        self.save_hyperparameters()\n",
    "        self.learning_rate = learning_rate\n",
    "        self.input_shape = input_shape\n",
    "        self.num_clases = num_classes\n",
    "        \n",
    "         # bloque convolucional: cuerpo de la red\n",
    "        \"\"\"\n",
    "        CLASS torch.nn.Conv2d(in_channels, out_channels, kernel_size, stride=1, \n",
    "        padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', device=None, dtype=None)\n",
    "        \"\"\"\n",
    "        self.conv1 = nn.Conv2d(3, 32, 3, 1)\n",
    "        self.conv2 = nn.Conv2d(32, 32, 3, 1)\n",
    "        self.conv3 = nn.Conv2d(32, 64, 3, 1)\n",
    "        self.conv4 = nn.Conv2d(64, 3, 1)\n",
    "\n",
    "        \"\"\"\n",
    "        CLASS torch.nn.MaxPool2d(kernel_size, stride=None, padding=0, dilation=1, \n",
    "        return_indices=False, ceil_mode=False)\n",
    "        \"\"\"\n",
    "        self.pool1 = torch.nn.MaxPool2d(2)\n",
    "        self.pool2 = torch.nn.MaxPool2d(2)\n",
    "        \n",
    "        n_sizes = self._get_conv_output(input_shape)\n",
    "\n",
    "\n",
    "        self.fc1 = nn.Linear(n_sizes, 512)\n",
    "        self.fc2 = nn.Linear(512, 128)\n",
    "        self.fc3 = nn.Linear(128, num_classes)\n",
    "\n",
    "\n",
    "        self.accuracy = torchmetrics.Accuracy(task ='multiclass', num_classes=self.num_clases)\n",
    "\n",
    "\n",
    "    # Calcula el tamaño de salida del bloque convolucional\n",
    "    # métodos auxiliares para calcular el tamaño de salida\n",
    "    # del bloque convolucion. Se requiere ara poder configurar \n",
    "    # totalmente la red. No requrido en Keras\n",
    "    def _get_conv_output(self, shape):\n",
    "        batch_size = 1\n",
    "        input = torch.autograd.Variable(torch.rand(batch_size, *shape))\n",
    "\n",
    "\n",
    "        output_feat = self._forward_features(input) \n",
    "        n_size = output_feat.data.view(batch_size, -1).size(1)\n",
    "        return n_size\n",
    "        \n",
    "    # devuelve el tensor de características del bloque conv\n",
    "    def _forward_features(self, x):\n",
    "        x = F.relu(self.conv1(x))\n",
    "        x = self.pool1(F.relu(self.conv2(x)))\n",
    "        x = F.relu(self.conv3(x))\n",
    "        x = self.pool2(F.relu(self.conv4(x)))\n",
    "        return x\n",
    "    \n",
    "    # forward\n",
    "    def forward(self, x):\n",
    "        x = self._forward_features(x)\n",
    "        x = x.view(x.size(0), -1)\n",
    "        x = F.relu(self.fc1(x))\n",
    "        x = F.relu(self.fc2(x))\n",
    "        x = F.log_softmax(self.fc3(x), dim=1)\n",
    "       \n",
    "        return x\n",
    "\n",
    "    # paso de entrenamiento\n",
    "    def training_step(self, batch, batch_idx):\n",
    "            x, y = batch\n",
    "            logits = self(x)\n",
    "            loss = F.nll_loss(logits, y)\n",
    "\n",
    "            # training metrics\n",
    "            preds = torch.argmax(logits, dim=1)\n",
    "            acc = self.accuracy(preds, y)\n",
    "            self.log('train_loss', loss, on_step=True, on_epoch=True, logger=True)\n",
    "            self.log('train_acc', acc, on_step=True, on_epoch=True, logger=True)\n",
    "\n",
    "            return loss\n",
    "\n",
    "    # paso de validación\n",
    "    def validation_step(self, batch, batch_idx):\n",
    "            x, y = batch\n",
    "            logits = self(x)\n",
    "            loss = F.nll_loss(logits, y)\n",
    "\n",
    "\n",
    "            # validation metrics\n",
    "            preds = torch.argmax(logits, dim=1)\n",
    "            acc = self.accuracy(preds, y)\n",
    "            self.log('val_loss', loss, prog_bar=True)\n",
    "            self.log('val_acc', acc, prog_bar=True)\n",
    "            return loss\n",
    "\n",
    "    # paso de prueba\n",
    "    def test_step(self, batch, batch_idx):\n",
    "        x, y = batch\n",
    "        logits = self(x)\n",
    "        loss = F.nll_loss(logits, y)\n",
    "        \n",
    "        # validation metrics\n",
    "        preds = torch.argmax(logits, dim=1)\n",
    "        acc = self.accuracy(preds, y)\n",
    "        self.log('test_loss', loss, prog_bar=True)\n",
    "        self.log('test_acc', acc, prog_bar=True)\n",
    "        return loss\n",
    "\n",
    "    # optimizador\n",
    "    def configure_optimizers(self):\n",
    "        optimizer = torch.optim.Adam(self.parameters(), lr=self.learning_rate)\n",
    "        return optimizer\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f9ff167f-641b-4454-9769-5e95be9af68a",
   "metadata": {},
   "source": [
    "## <span style=\"color:blue\">Entrenamiento y Evaluación</span>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d16fc9a4-d3e4-48d6-968c-f111578fe4ae",
   "metadata": {},
   "source": [
    "Ahora que organizamos nuestra canalización de datos con `DataModule` y modelamos la arquitectura del modelo con `nn.Module` y el ciclo de entrenamiento con `LightningModule`, PyTorch Lightning `Trainer` automatiza todo lo demás por nosotros.\n",
    "\n",
    "El Entrenador automatiza:\n",
    "\n",
    "* Iteración de época y lote\n",
    "* Llamada de `optimizer.step()`, `backward`, `zero_grad()`\n",
    "* Llamada de `.eval()`, habilitación/deshabilitación de gradientes\n",
    "* Guardar y cargar pesos\n",
    "* Registro de pesos y sesgos\n",
    "* Soporte de entrenamiento multi-GPU\n",
    "* Soporte de TPU\n",
    "* soporte de entrenamiento de 16 bits\n",
    "\n",
    "\n",
    "Primero inicializaremos nuestra canalización de datos. El Entrenador solo necesita un  DataLoader de PyTorch para los datos de entrenamiento/val/prueba. \n",
    "\n",
    "Podemos pasar directamente el objeto `dm` que hemos creado al Entrenador. Pero dado que necesitamos algunas muestras para nuestro `ImagePredictionLogger`, llamaremos manualmente a los métodos *prepare_data* y *setup*."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9575df58-12a7-4c57-a0bb-99735900c002",
   "metadata": {},
   "source": [
    "### <span style=\"color:#4CC9F0\">Instancia los datos</span>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "bdd035a5-1d80-4383-88ff-1cd5123f0eb5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Files already downloaded and verified\n",
      "Files already downloaded and verified\n"
     ]
    }
   ],
   "source": [
    "# Inicializa la canalización de los datos\n",
    "dm = CIFAR10DataModule(batch_size=32)\n",
    "# Para acceder a los  x_dataloader prepara los datos y configurar\n",
    "dm.prepare_data()\n",
    "dm.setup()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "e7109729-be90-47cf-8072-e2860cab7b28",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(torch.Size([32, 3, 32, 32]), torch.Size([32]))"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Muestras requeridas por la devolución de llamada personalizada de ImagePredictionLogger \n",
    "# para registrar predicciones de imágenes.\n",
    "val_samples = next(iter(dm.val_dataloader()))\n",
    "val_imgs, val_labels = val_samples[0], val_samples[1]\n",
    "val_imgs.shape, val_labels.shape\n",
    " "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "58f223c4-5ad7-46b8-9f88-f984d9904502",
   "metadata": {},
   "source": [
    "Solo necesitamos inicializar el modelo y nuestro logger favorito. Tenga en cuenta que hemos pasado checkpoint_callback por separado. "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "08e05fba-eca3-4590-a344-ffff7994da9c",
   "metadata": {},
   "source": [
    "### <span style=\"color:#4CC9F0\">Instancia el modelo</span>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "812ed2f8-fec5-4855-b01d-ec282a1c3123",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[W NNPACK.cpp:64] Could not initialize NNPACK! Reason: Unsupported hardware.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "LitModel(\n",
       "  (conv1): Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1))\n",
       "  (conv2): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1))\n",
       "  (conv3): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1))\n",
       "  (conv4): Conv2d(64, 3, kernel_size=(1, 1), stride=(1, 1))\n",
       "  (pool1): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
       "  (pool2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
       "  (fc1): Linear(in_features=108, out_features=512, bias=True)\n",
       "  (fc2): Linear(in_features=512, out_features=128, bias=True)\n",
       "  (fc3): Linear(in_features=128, out_features=10, bias=True)\n",
       "  (accuracy): MulticlassAccuracy()\n",
       ")"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Instancia el modelo\n",
    "inputshape = (3,32, 32)\n",
    "numclases = 10\n",
    "\n",
    "model = LitModel(inputshape, numclases)\n",
    "model"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "34536afb-b003-4ed7-b866-dee50105f6b0",
   "metadata": {},
   "source": [
    "### <span style=\"color:#4CC9F0\">Instancia el trainer</span>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "2dea1c5b-27be-4b2a-ad23-034b165815d4",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33mammontenegrod\u001b[0m (\u001b[33maprendizaje-profundo\u001b[0m). Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "Tracking run with wandb version 0.15.2"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "Run data is saved locally in <code>./wandb/run-20230515_094528-p407cj4f</code>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "Syncing run <strong><a href='https://wandb.ai/aprendizaje-profundo/CIFAR10/runs/p407cj4f' target=\"_blank\">cosmic-bird-12</a></strong> to <a href='https://wandb.ai/aprendizaje-profundo/CIFAR10' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/run' target=\"_blank\">docs</a>)<br/>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       " View project at <a href='https://wandb.ai/aprendizaje-profundo/CIFAR10' target=\"_blank\">https://wandb.ai/aprendizaje-profundo/CIFAR10</a>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       " View run at <a href='https://wandb.ai/aprendizaje-profundo/CIFAR10/runs/p407cj4f' target=\"_blank\">https://wandb.ai/aprendizaje-profundo/CIFAR10/runs/p407cj4f</a>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Inicializa wandb logger\n",
    "#wandb_logger = WandbLogger(project='wandb-lightning', job_type='train')\n",
    "wandb_logger = WandbLogger(project='CIFAR10', \n",
    "               config={\n",
    "               \"learning_rate\": 0.02,\n",
    "               \"architecture\": \"CNN\",\n",
    "               \"dataset\": \"CIFAR-100\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "cf378de5-c068-4100-abcb-746edcd0d6b2",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/alvaro/anaconda3/envs/lightning/lib/python3.11/site-packages/lightning_fabric/connector.py:562: UserWarning: 16 is supported for historical reasons but its usage is discouraged. Please set your precision to 16-mixed instead!\n",
      "  rank_zero_warn(\n",
      "/home/alvaro/anaconda3/envs/lightning/lib/python3.11/site-packages/pytorch_lightning/trainer/connectors/accelerator_connector.py:517: UserWarning: You passed `Trainer(accelerator='cpu', precision='16-mixed')` but AMP with fp16 is not supported on CPU. Using `precision='bf16-mixed'` instead.\n",
      "  rank_zero_warn(\n",
      "Using bfloat16 Automatic Mixed Precision (AMP)\n",
      "GPU available: False, used: False\n",
      "TPU available: False, using: 0 TPU cores\n",
      "IPU available: False, using: 0 IPUs\n",
      "HPU available: False, using: 0 HPUs\n"
     ]
    }
   ],
   "source": [
    "# Initialize a trainer\n",
    "trainer = pl.Trainer(max_epochs=5,\n",
    "                     precision=16,\n",
    "                     logger=wandb_logger,\n",
    "                     limit_train_batches=0.25,\n",
    "                     default_root_dir=\"../Checkpoints\",\n",
    "                      )"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f850465-4a7a-4da6-b98d-8bf178293907",
   "metadata": {},
   "source": [
    "### <span style=\"color:#4CC9F0\">Entrena el modelo</span>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "165f41ea-411f-4afb-9ccc-1b94a2e34474",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Files already downloaded and verified\n",
      "Files already downloaded and verified\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "  | Name     | Type               | Params\n",
      "------------------------------------------------\n",
      "0 | conv1    | Conv2d             | 896   \n",
      "1 | conv2    | Conv2d             | 9.2 K \n",
      "2 | conv3    | Conv2d             | 18.5 K\n",
      "3 | conv4    | Conv2d             | 195   \n",
      "4 | pool1    | MaxPool2d          | 0     \n",
      "5 | pool2    | MaxPool2d          | 0     \n",
      "6 | fc1      | Linear             | 55.8 K\n",
      "7 | fc2      | Linear             | 65.7 K\n",
      "8 | fc3      | Linear             | 1.3 K \n",
      "9 | accuracy | MulticlassAccuracy | 0     \n",
      "------------------------------------------------\n",
      "151 K     Trainable params\n",
      "0         Non-trainable params\n",
      "151 K     Total params\n",
      "0.606     Total estimated model params size (MB)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 0: 100%|████████████████████| 351/351 [08:28<00:00,  1.45s/it, v_num=cj4f]\n",
      "Validation: 0it [00:00, ?it/s]\u001b[A\n",
      "Validation:   0%|                                       | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   0%|                          | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|                  | 1/157 [00:00<01:17,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|▏                 | 2/157 [00:00<01:13,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:   2%|▎                 | 3/157 [00:01<01:12,  2.12it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▍                 | 4/157 [00:01<01:11,  2.13it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▌                 | 5/157 [00:02<01:11,  2.13it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▋                 | 6/157 [00:02<01:12,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▊                 | 7/157 [00:03<01:11,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:   5%|▉                 | 8/157 [00:03<01:10,  2.12it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                 | 9/157 [00:04<01:10,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                | 10/157 [00:04<01:10,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:   7%|█▏               | 11/157 [00:05<01:10,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▎               | 12/157 [00:05<01:09,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▍               | 13/157 [00:06<01:09,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:   9%|█▌               | 14/157 [00:06<01:10,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▌               | 15/157 [00:07<01:09,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▋               | 16/157 [00:07<01:09,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▊               | 17/157 [00:08<01:08,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▉               | 18/157 [00:08<01:09,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  12%|██               | 19/157 [00:09<01:08,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▏              | 20/157 [00:09<01:07,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▎              | 21/157 [00:10<01:07,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  14%|██▍              | 22/157 [00:10<01:06,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▍              | 23/157 [00:11<01:06,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▌              | 24/157 [00:11<01:06,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  16%|██▋              | 25/157 [00:12<01:05,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▊              | 26/157 [00:12<01:05,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▉              | 27/157 [00:13<01:04,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███              | 28/157 [00:13<01:04,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███▏             | 29/157 [00:14<01:03,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  19%|███▏             | 30/157 [00:14<01:02,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▎             | 31/157 [00:15<01:02,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▍             | 32/157 [00:15<01:01,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  21%|███▌             | 33/157 [00:16<01:01,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▋             | 34/157 [00:16<01:00,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▊             | 35/157 [00:17<01:00,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  23%|███▉             | 36/157 [00:17<00:59,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 37/157 [00:18<00:59,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 38/157 [00:18<00:58,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▏            | 39/157 [00:19<00:58,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▎            | 40/157 [00:19<00:57,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  26%|████▍            | 41/157 [00:20<00:56,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▌            | 42/157 [00:20<00:56,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▋            | 43/157 [00:21<00:56,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  28%|████▊            | 44/157 [00:21<00:55,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▊            | 45/157 [00:22<00:54,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▉            | 46/157 [00:22<00:54,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  30%|█████            | 47/157 [00:23<00:53,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▏           | 48/157 [00:23<00:53,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▎           | 49/157 [00:24<00:52,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▍           | 50/157 [00:24<00:52,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▌           | 51/157 [00:25<00:52,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  33%|█████▋           | 52/157 [00:25<00:51,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▋           | 53/157 [00:26<00:51,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▊           | 54/157 [00:26<00:50,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  35%|█████▉           | 55/157 [00:27<00:50,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████           | 56/157 [00:27<00:49,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████▏          | 57/157 [00:27<00:49,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  37%|██████▎          | 58/157 [00:28<00:48,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 59/157 [00:28<00:47,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 60/157 [00:29<00:47,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▌          | 61/157 [00:29<00:47,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▋          | 62/157 [00:30<00:46,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  40%|██████▊          | 63/157 [00:31<00:46,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|██████▉          | 64/157 [00:31<00:45,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|███████          | 65/157 [00:31<00:45,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  42%|███████▏         | 66/157 [00:32<00:44,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 67/157 [00:32<00:44,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 68/157 [00:33<00:43,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  44%|███████▍         | 69/157 [00:34<00:43,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▌         | 70/157 [00:34<00:42,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▋         | 71/157 [00:35<00:42,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▊         | 72/157 [00:35<00:41,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▉         | 73/157 [00:35<00:41,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  47%|████████         | 74/157 [00:36<00:40,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████         | 75/157 [00:36<00:40,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████▏        | 76/157 [00:37<00:39,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  49%|████████▎        | 77/157 [00:37<00:39,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▍        | 78/157 [00:38<00:38,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▌        | 79/157 [00:38<00:38,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  51%|████████▋        | 80/157 [00:39<00:37,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▊        | 81/157 [00:39<00:37,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▉        | 82/157 [00:40<00:36,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  53%|████████▉        | 83/157 [00:40<00:36,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████        | 84/157 [00:41<00:35,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████▏       | 85/157 [00:41<00:35,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▎       | 86/157 [00:42<00:34,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▍       | 87/157 [00:42<00:34,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  56%|█████████▌       | 88/157 [00:43<00:33,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 89/157 [00:43<00:33,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 90/157 [00:44<00:32,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  58%|█████████▊       | 91/157 [00:44<00:32,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|█████████▉       | 92/157 [00:45<00:32,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|██████████       | 93/157 [00:46<00:31,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  60%|██████████▏      | 94/157 [00:46<00:31,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▎      | 95/157 [00:46<00:30,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▍      | 96/157 [00:47<00:30,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 97/157 [00:48<00:29,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 98/157 [00:48<00:29,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  63%|██████████▋      | 99/157 [00:49<00:28,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▏     | 100/157 [00:49<00:28,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▎     | 101/157 [00:49<00:27,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  65%|██████████▍     | 102/157 [00:50<00:27,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▍     | 103/157 [00:51<00:26,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▌     | 104/157 [00:51<00:26,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  67%|██████████▋     | 105/157 [00:52<00:25,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▊     | 106/157 [00:52<00:25,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▉     | 107/157 [00:52<00:24,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 108/157 [00:53<00:24,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 109/157 [00:53<00:23,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  70%|███████████▏    | 110/157 [00:54<00:23,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▎    | 111/157 [00:54<00:22,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▍    | 112/157 [00:55<00:22,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  72%|███████████▌    | 113/157 [00:55<00:21,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▌    | 114/157 [00:56<00:21,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▋    | 115/157 [00:56<00:20,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  74%|███████████▊    | 116/157 [00:57<00:20,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|███████████▉    | 117/157 [00:57<00:19,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|████████████    | 118/157 [00:58<00:19,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 119/157 [00:58<00:18,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 120/157 [00:59<00:18,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  77%|████████████▎   | 121/157 [00:59<00:17,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▍   | 122/157 [01:00<00:17,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▌   | 123/157 [01:00<00:16,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  79%|████████████▋   | 124/157 [01:01<00:16,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▋   | 125/157 [01:01<00:15,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▊   | 126/157 [01:02<00:15,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  81%|████████████▉   | 127/157 [01:02<00:14,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████   | 128/157 [01:03<00:14,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████▏  | 129/157 [01:03<00:13,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▏  | 130/157 [01:04<00:13,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▎  | 131/157 [01:04<00:12,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  84%|█████████████▍  | 132/157 [01:05<00:12,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▌  | 133/157 [01:05<00:11,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▋  | 134/157 [01:06<00:11,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  86%|█████████████▊  | 135/157 [01:07<00:10,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▊  | 136/157 [01:07<00:10,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▉  | 137/157 [01:07<00:09,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  88%|██████████████  | 138/157 [01:08<00:09,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▏ | 139/157 [01:08<00:08,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▎ | 140/157 [01:09<00:08,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▎ | 141/157 [01:09<00:07,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▍ | 142/157 [01:10<00:07,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  91%|██████████████▌ | 143/157 [01:10<00:06,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▋ | 144/157 [01:11<00:06,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▊ | 145/157 [01:11<00:05,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  93%|██████████████▉ | 146/157 [01:12<00:05,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|██████████████▉ | 147/157 [01:13<00:04,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|███████████████ | 148/157 [01:13<00:04,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  95%|███████████████▏| 149/157 [01:14<00:03,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▎| 150/157 [01:14<00:03,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▍| 151/157 [01:15<00:02,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▍| 152/157 [01:15<00:02,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▌| 153/157 [01:16<00:01,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  98%|███████████████▋| 154/157 [01:16<00:01,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▊| 155/157 [01:17<00:00,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▉| 156/157 [01:17<00:00,  2.01it/s]\u001b[A\n",
      "Epoch 0: 100%|█| 351/351 [09:46<00:00,  1.67s/it, v_num=cj4f, val_loss=1.830, va\u001b[A\n",
      "Epoch 1: 100%|█| 351/351 [18:04<00:00,  3.09s/it, v_num=cj4f, val_loss=1.830, va\u001b[A\n",
      "Validation: 0it [00:00, ?it/s]\u001b[A\n",
      "Validation:   0%|                                       | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   0%|                          | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|                  | 1/157 [00:00<01:08,  2.29it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|▏                 | 2/157 [00:00<01:08,  2.27it/s]\u001b[A\n",
      "Validation DataLoader 0:   2%|▎                 | 3/157 [00:01<01:07,  2.28it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▍                 | 4/157 [00:01<01:07,  2.28it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▌                 | 5/157 [00:02<01:06,  2.29it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▋                 | 6/157 [00:02<01:07,  2.24it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▊                 | 7/157 [00:03<01:09,  2.15it/s]\u001b[A\n",
      "Validation DataLoader 0:   5%|▉                 | 8/157 [00:03<01:09,  2.16it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                 | 9/157 [00:04<01:07,  2.18it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                | 10/157 [00:04<01:06,  2.20it/s]\u001b[A\n",
      "Validation DataLoader 0:   7%|█▏               | 11/157 [00:05<01:08,  2.14it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▎               | 12/157 [00:05<01:07,  2.15it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▍               | 13/157 [00:06<01:07,  2.13it/s]\u001b[A\n",
      "Validation DataLoader 0:   9%|█▌               | 14/157 [00:06<01:06,  2.15it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▌               | 15/157 [00:06<01:05,  2.16it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▋               | 16/157 [00:07<01:04,  2.18it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▊               | 17/157 [00:07<01:04,  2.19it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▉               | 18/157 [00:08<01:03,  2.20it/s]\u001b[A\n",
      "Validation DataLoader 0:  12%|██               | 19/157 [00:08<01:02,  2.20it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▏              | 20/157 [00:09<01:02,  2.20it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▎              | 21/157 [00:09<01:01,  2.21it/s]\u001b[A\n",
      "Validation DataLoader 0:  14%|██▍              | 22/157 [00:09<01:00,  2.22it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▍              | 23/157 [00:10<01:00,  2.21it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▌              | 24/157 [00:10<00:59,  2.22it/s]\u001b[A\n",
      "Validation DataLoader 0:  16%|██▋              | 25/157 [00:11<00:59,  2.23it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▊              | 26/157 [00:11<00:58,  2.23it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▉              | 27/157 [00:12<00:58,  2.22it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███              | 28/157 [00:12<00:58,  2.20it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███▏             | 29/157 [00:13<00:58,  2.18it/s]\u001b[A\n",
      "Validation DataLoader 0:  19%|███▏             | 30/157 [00:13<00:58,  2.16it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▎             | 31/157 [00:14<00:58,  2.15it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▍             | 32/157 [00:14<00:58,  2.14it/s]\u001b[A\n",
      "Validation DataLoader 0:  21%|███▌             | 33/157 [00:15<00:58,  2.13it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▋             | 34/157 [00:16<00:58,  2.12it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▊             | 35/157 [00:16<00:58,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  23%|███▉             | 36/157 [00:17<00:57,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 37/157 [00:17<00:57,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 38/157 [00:18<00:56,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▏            | 39/157 [00:18<00:56,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▎            | 40/157 [00:19<00:55,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  26%|████▍            | 41/157 [00:19<00:55,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▌            | 42/157 [00:20<00:54,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▋            | 43/157 [00:20<00:54,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  28%|████▊            | 44/157 [00:20<00:53,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▊            | 45/157 [00:21<00:53,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▉            | 46/157 [00:21<00:52,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  30%|█████            | 47/157 [00:22<00:52,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▏           | 48/157 [00:22<00:51,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▎           | 49/157 [00:23<00:51,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▍           | 50/157 [00:24<00:51,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▌           | 51/157 [00:24<00:50,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  33%|█████▋           | 52/157 [00:24<00:50,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▋           | 53/157 [00:25<00:49,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▊           | 54/157 [00:25<00:49,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  35%|█████▉           | 55/157 [00:26<00:48,  2.11it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████           | 56/157 [00:26<00:47,  2.11it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████▏          | 57/157 [00:27<00:47,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  37%|██████▎          | 58/157 [00:27<00:47,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 59/157 [00:28<00:46,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 60/157 [00:28<00:46,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▌          | 61/157 [00:29<00:45,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▋          | 62/157 [00:29<00:45,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  40%|██████▊          | 63/157 [00:29<00:44,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|██████▉          | 64/157 [00:30<00:44,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|███████          | 65/157 [00:30<00:43,  2.11it/s]\u001b[A\n",
      "Validation DataLoader 0:  42%|███████▏         | 66/157 [00:31<00:43,  2.10it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 67/157 [00:32<00:43,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 68/157 [00:32<00:42,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  44%|███████▍         | 69/157 [00:33<00:42,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▌         | 70/157 [00:33<00:41,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▋         | 71/157 [00:34<00:41,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▊         | 72/157 [00:34<00:40,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▉         | 73/157 [00:35<00:40,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  47%|████████         | 74/157 [00:35<00:39,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████         | 75/157 [00:36<00:39,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████▏        | 76/157 [00:36<00:38,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  49%|████████▎        | 77/157 [00:36<00:38,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▍        | 78/157 [00:37<00:37,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▌        | 79/157 [00:37<00:37,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  51%|████████▋        | 80/157 [00:38<00:36,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▊        | 81/157 [00:38<00:36,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▉        | 82/157 [00:39<00:35,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  53%|████████▉        | 83/157 [00:39<00:35,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████        | 84/157 [00:40<00:35,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████▏       | 85/157 [00:40<00:34,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▎       | 86/157 [00:41<00:34,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▍       | 87/157 [00:41<00:33,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  56%|█████████▌       | 88/157 [00:42<00:33,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 89/157 [00:43<00:32,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 90/157 [00:43<00:32,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:  58%|█████████▊       | 91/157 [00:44<00:32,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|█████████▉       | 92/157 [00:44<00:31,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|██████████       | 93/157 [00:45<00:31,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  60%|██████████▏      | 94/157 [00:45<00:30,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▎      | 95/157 [00:46<00:30,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▍      | 96/157 [00:46<00:29,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 97/157 [00:47<00:29,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 98/157 [00:47<00:28,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  63%|██████████▋      | 99/157 [00:48<00:28,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▏     | 100/157 [00:49<00:28,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▎     | 101/157 [00:49<00:27,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  65%|██████████▍     | 102/157 [00:50<00:27,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▍     | 103/157 [00:50<00:26,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▌     | 104/157 [00:51<00:26,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  67%|██████████▋     | 105/157 [00:51<00:25,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▊     | 106/157 [00:52<00:25,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▉     | 107/157 [00:52<00:24,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 108/157 [00:53<00:24,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 109/157 [00:53<00:23,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  70%|███████████▏    | 110/157 [00:54<00:23,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▎    | 111/157 [00:54<00:22,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▍    | 112/157 [00:55<00:22,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  72%|███████████▌    | 113/157 [00:55<00:21,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▌    | 114/157 [00:56<00:21,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▋    | 115/157 [00:56<00:20,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  74%|███████████▊    | 116/157 [00:57<00:20,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|███████████▉    | 117/157 [00:57<00:19,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|████████████    | 118/157 [00:58<00:19,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 119/157 [00:58<00:18,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 120/157 [00:59<00:18,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  77%|████████████▎   | 121/157 [00:59<00:17,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▍   | 122/157 [01:00<00:17,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▌   | 123/157 [01:01<00:16,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  79%|████████████▋   | 124/157 [01:01<00:16,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▋   | 125/157 [01:02<00:15,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▊   | 126/157 [01:03<00:15,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  81%|████████████▉   | 127/157 [01:03<00:15,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████   | 128/157 [01:04<00:14,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████▏  | 129/157 [01:04<00:14,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▏  | 130/157 [01:05<00:13,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▎  | 131/157 [01:05<00:13,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  84%|█████████████▍  | 132/157 [01:06<00:12,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▌  | 133/157 [01:06<00:12,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▋  | 134/157 [01:07<00:11,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  86%|█████████████▊  | 135/157 [01:07<00:11,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▊  | 136/157 [01:08<00:10,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▉  | 137/157 [01:08<00:10,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  88%|██████████████  | 138/157 [01:09<00:09,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▏ | 139/157 [01:09<00:09,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▎ | 140/157 [01:10<00:08,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▎ | 141/157 [01:10<00:08,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▍ | 142/157 [01:11<00:07,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  91%|██████████████▌ | 143/157 [01:11<00:07,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▋ | 144/157 [01:12<00:06,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▊ | 145/157 [01:13<00:06,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  93%|██████████████▉ | 146/157 [01:13<00:05,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|██████████████▉ | 147/157 [01:14<00:05,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|███████████████ | 148/157 [01:14<00:04,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  95%|███████████████▏| 149/157 [01:15<00:04,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▎| 150/157 [01:15<00:03,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▍| 151/157 [01:16<00:03,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▍| 152/157 [01:17<00:02,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▌| 153/157 [01:17<00:02,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  98%|███████████████▋| 154/157 [01:18<00:01,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▊| 155/157 [01:18<00:01,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▉| 156/157 [01:19<00:00,  1.97it/s]\u001b[A\n",
      "Epoch 1: 100%|█| 351/351 [19:24<00:00,  3.32s/it, v_num=cj4f, val_loss=1.720, va\u001b[A\n",
      "Epoch 2: 100%|█| 351/351 [08:46<00:00,  1.50s/it, v_num=cj4f, val_loss=1.720, va\u001b[A\n",
      "Validation: 0it [00:00, ?it/s]\u001b[A\n",
      "Validation:   0%|                                       | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   0%|                          | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|                  | 1/157 [00:00<01:22,  1.90it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|▏                 | 2/157 [00:00<01:16,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:   2%|▎                 | 3/157 [00:01<01:14,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▍                 | 4/157 [00:02<01:19,  1.93it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▌                 | 5/157 [00:02<01:17,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▋                 | 6/157 [00:03<01:19,  1.91it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▊                 | 7/157 [00:03<01:17,  1.94it/s]\u001b[A\n",
      "Validation DataLoader 0:   5%|▉                 | 8/157 [00:04<01:15,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                 | 9/157 [00:04<01:15,  1.95it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                | 10/157 [00:05<01:14,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:   7%|█▏               | 11/157 [00:05<01:15,  1.94it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▎               | 12/157 [00:06<01:14,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▍               | 13/157 [00:06<01:14,  1.93it/s]\u001b[A\n",
      "Validation DataLoader 0:   9%|█▌               | 14/157 [00:07<01:14,  1.91it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▌               | 15/157 [00:07<01:15,  1.89it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▋               | 16/157 [00:08<01:14,  1.90it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▊               | 17/157 [00:08<01:13,  1.92it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▉               | 18/157 [00:09<01:12,  1.93it/s]\u001b[A\n",
      "Validation DataLoader 0:  12%|██               | 19/157 [00:09<01:11,  1.93it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▏              | 20/157 [00:10<01:10,  1.94it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▎              | 21/157 [00:10<01:09,  1.95it/s]\u001b[A\n",
      "Validation DataLoader 0:  14%|██▍              | 22/157 [00:11<01:08,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▍              | 23/157 [00:11<01:08,  1.94it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▌              | 24/157 [00:12<01:08,  1.95it/s]\u001b[A\n",
      "Validation DataLoader 0:  16%|██▋              | 25/157 [00:12<01:07,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▊              | 26/157 [00:13<01:06,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▉              | 27/157 [00:13<01:05,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███              | 28/157 [00:14<01:05,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███▏             | 29/157 [00:14<01:05,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  19%|███▏             | 30/157 [00:15<01:04,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▎             | 31/157 [00:15<01:04,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▍             | 32/157 [00:16<01:03,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  21%|███▌             | 33/157 [00:16<01:03,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▋             | 34/157 [00:17<01:02,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▊             | 35/157 [00:17<01:02,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  23%|███▉             | 36/157 [00:18<01:01,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 37/157 [00:18<01:01,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 38/157 [00:19<01:00,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▏            | 39/157 [00:19<00:59,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▎            | 40/157 [00:20<00:59,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  26%|████▍            | 41/157 [00:20<00:58,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▌            | 42/157 [00:21<00:58,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▋            | 43/157 [00:22<00:58,  1.95it/s]\u001b[A\n",
      "Validation DataLoader 0:  28%|████▊            | 44/157 [00:22<00:58,  1.94it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▊            | 45/157 [00:23<00:57,  1.94it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▉            | 46/157 [00:23<00:57,  1.94it/s]\u001b[A\n",
      "Validation DataLoader 0:  30%|█████            | 47/157 [00:24<00:56,  1.95it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▏           | 48/157 [00:24<00:55,  1.95it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▎           | 49/157 [00:25<00:55,  1.95it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▍           | 50/157 [00:25<00:54,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▌           | 51/157 [00:26<00:54,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  33%|█████▋           | 52/157 [00:26<00:53,  1.96it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▋           | 53/157 [00:26<00:52,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▊           | 54/157 [00:27<00:52,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  35%|█████▉           | 55/157 [00:27<00:51,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████           | 56/157 [00:28<00:51,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████▏          | 57/157 [00:28<00:50,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  37%|██████▎          | 58/157 [00:29<00:49,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 59/157 [00:29<00:49,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 60/157 [00:30<00:48,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▌          | 61/157 [00:30<00:48,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▋          | 62/157 [00:31<00:47,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  40%|██████▊          | 63/157 [00:31<00:47,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|██████▉          | 64/157 [00:32<00:46,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|███████          | 65/157 [00:32<00:46,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  42%|███████▏         | 66/157 [00:33<00:45,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 67/157 [00:33<00:45,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 68/157 [00:34<00:44,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  44%|███████▍         | 69/157 [00:34<00:44,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▌         | 70/157 [00:35<00:43,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▋         | 71/157 [00:35<00:43,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▊         | 72/157 [00:36<00:42,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▉         | 73/157 [00:36<00:41,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  47%|████████         | 74/157 [00:36<00:41,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████         | 75/157 [00:37<00:40,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████▏        | 76/157 [00:37<00:40,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  49%|████████▎        | 77/157 [00:38<00:40,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▍        | 78/157 [00:39<00:39,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▌        | 79/157 [00:39<00:39,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  51%|████████▋        | 80/157 [00:40<00:38,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▊        | 81/157 [00:40<00:38,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▉        | 82/157 [00:41<00:37,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  53%|████████▉        | 83/157 [00:41<00:37,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████        | 84/157 [00:42<00:36,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████▏       | 85/157 [00:42<00:36,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▎       | 86/157 [00:43<00:35,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▍       | 87/157 [00:43<00:35,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  56%|█████████▌       | 88/157 [00:44<00:34,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 89/157 [00:44<00:34,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 90/157 [00:45<00:33,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  58%|█████████▊       | 91/157 [00:45<00:33,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|█████████▉       | 92/157 [00:46<00:32,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|██████████       | 93/157 [00:46<00:32,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  60%|██████████▏      | 94/157 [00:47<00:31,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▎      | 95/157 [00:47<00:31,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▍      | 96/157 [00:48<00:30,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 97/157 [00:48<00:30,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 98/157 [00:49<00:29,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  63%|██████████▋      | 99/157 [00:49<00:29,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▏     | 100/157 [00:50<00:28,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▎     | 101/157 [00:50<00:28,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  65%|██████████▍     | 102/157 [00:51<00:27,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▍     | 103/157 [00:51<00:27,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▌     | 104/157 [00:52<00:26,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  67%|██████████▋     | 105/157 [00:52<00:26,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▊     | 106/157 [00:53<00:25,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▉     | 107/157 [00:54<00:25,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 108/157 [00:54<00:24,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 109/157 [00:55<00:24,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  70%|███████████▏    | 110/157 [00:55<00:23,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▎    | 111/157 [00:55<00:23,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▍    | 112/157 [00:56<00:22,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  72%|███████████▌    | 113/157 [00:57<00:22,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▌    | 114/157 [00:57<00:21,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▋    | 115/157 [00:58<00:21,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  74%|███████████▊    | 116/157 [00:58<00:20,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|███████████▉    | 117/157 [00:59<00:20,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|████████████    | 118/157 [00:59<00:19,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 119/157 [01:00<00:19,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 120/157 [01:00<00:18,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  77%|████████████▎   | 121/157 [01:01<00:18,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▍   | 122/157 [01:01<00:17,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▌   | 123/157 [01:02<00:17,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  79%|████████████▋   | 124/157 [01:02<00:16,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▋   | 125/157 [01:03<00:16,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▊   | 126/157 [01:03<00:15,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  81%|████████████▉   | 127/157 [01:04<00:15,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████   | 128/157 [01:04<00:14,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████▏  | 129/157 [01:05<00:14,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▏  | 130/157 [01:05<00:13,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▎  | 131/157 [01:06<00:13,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  84%|█████████████▍  | 132/157 [01:06<00:12,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▌  | 133/157 [01:07<00:12,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▋  | 134/157 [01:07<00:11,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  86%|█████████████▊  | 135/157 [01:08<00:11,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▊  | 136/157 [01:08<00:10,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▉  | 137/157 [01:09<00:10,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  88%|██████████████  | 138/157 [01:09<00:09,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▏ | 139/157 [01:10<00:09,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▎ | 140/157 [01:10<00:08,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▎ | 141/157 [01:10<00:08,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▍ | 142/157 [01:11<00:07,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  91%|██████████████▌ | 143/157 [01:12<00:07,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▋ | 144/157 [01:12<00:06,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▊ | 145/157 [01:12<00:06,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  93%|██████████████▉ | 146/157 [01:13<00:05,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|██████████████▉ | 147/157 [01:13<00:05,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|███████████████ | 148/157 [01:14<00:04,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  95%|███████████████▏| 149/157 [01:15<00:04,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▎| 150/157 [01:15<00:03,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▍| 151/157 [01:16<00:03,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▍| 152/157 [01:16<00:02,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▌| 153/157 [01:17<00:02,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  98%|███████████████▋| 154/157 [01:17<00:01,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▊| 155/157 [01:18<00:01,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▉| 156/157 [01:18<00:00,  1.99it/s]\u001b[A\n",
      "Epoch 2: 100%|█| 351/351 [10:05<00:00,  1.72s/it, v_num=cj4f, val_loss=1.650, va\u001b[A\n",
      "Epoch 3: 100%|█| 351/351 [08:18<00:00,  1.42s/it, v_num=cj4f, val_loss=1.650, va\u001b[A\n",
      "Validation: 0it [00:00, ?it/s]\u001b[A\n",
      "Validation:   0%|                                       | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   0%|                          | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|                  | 1/157 [00:00<01:17,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|▏                 | 2/157 [00:00<01:14,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:   2%|▎                 | 3/157 [00:01<01:13,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▍                 | 4/157 [00:01<01:12,  2.11it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▌                 | 5/157 [00:02<01:11,  2.12it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▋                 | 6/157 [00:02<01:12,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▊                 | 7/157 [00:03<01:11,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:   5%|▉                 | 8/157 [00:03<01:12,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                 | 9/157 [00:04<01:11,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                | 10/157 [00:04<01:11,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:   7%|█▏               | 11/157 [00:05<01:12,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▎               | 12/157 [00:05<01:11,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▍               | 13/157 [00:06<01:10,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:   9%|█▌               | 14/157 [00:06<01:10,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▌               | 15/157 [00:07<01:09,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▋               | 16/157 [00:07<01:08,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▊               | 17/157 [00:08<01:08,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▉               | 18/157 [00:08<01:07,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:  12%|██               | 19/157 [00:09<01:06,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▏              | 20/157 [00:09<01:06,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▎              | 21/157 [00:10<01:05,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  14%|██▍              | 22/157 [00:10<01:04,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▍              | 23/157 [00:11<01:04,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▌              | 24/157 [00:11<01:03,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  16%|██▋              | 25/157 [00:11<01:03,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▊              | 26/157 [00:12<01:02,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▉              | 27/157 [00:12<01:02,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███              | 28/157 [00:13<01:01,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███▏             | 29/157 [00:13<01:01,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  19%|███▏             | 30/157 [00:14<01:00,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▎             | 31/157 [00:14<01:00,  2.09it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▍             | 32/157 [00:15<01:00,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  21%|███▌             | 33/157 [00:15<00:59,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▋             | 34/157 [00:16<00:59,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▊             | 35/157 [00:16<00:58,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  23%|███▉             | 36/157 [00:17<00:58,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 37/157 [00:17<00:57,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 38/157 [00:18<00:57,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▏            | 39/157 [00:18<00:56,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▎            | 40/157 [00:19<00:56,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  26%|████▍            | 41/157 [00:19<00:55,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▌            | 42/157 [00:20<00:55,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▋            | 43/157 [00:20<00:54,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  28%|████▊            | 44/157 [00:21<00:54,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▊            | 45/157 [00:21<00:54,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▉            | 46/157 [00:22<00:54,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  30%|█████            | 47/157 [00:23<00:54,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▏           | 48/157 [00:23<00:53,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▎           | 49/157 [00:24<00:53,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▍           | 50/157 [00:24<00:52,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▌           | 51/157 [00:25<00:52,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  33%|█████▋           | 52/157 [00:25<00:51,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▋           | 53/157 [00:26<00:51,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▊           | 54/157 [00:26<00:51,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  35%|█████▉           | 55/157 [00:27<00:50,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████           | 56/157 [00:27<00:50,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████▏          | 57/157 [00:28<00:49,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  37%|██████▎          | 58/157 [00:29<00:49,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 59/157 [00:29<00:49,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 60/157 [00:30<00:48,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▌          | 61/157 [00:30<00:48,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▋          | 62/157 [00:31<00:47,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  40%|██████▊          | 63/157 [00:31<00:47,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|██████▉          | 64/157 [00:32<00:46,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|███████          | 65/157 [00:32<00:45,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  42%|███████▏         | 66/157 [00:32<00:45,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 67/157 [00:33<00:44,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 68/157 [00:33<00:44,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  44%|███████▍         | 69/157 [00:34<00:44,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▌         | 70/157 [00:35<00:43,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▋         | 71/157 [00:35<00:42,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▊         | 72/157 [00:36<00:42,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▉         | 73/157 [00:36<00:42,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  47%|████████         | 74/157 [00:37<00:41,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████         | 75/157 [00:37<00:41,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████▏        | 76/157 [00:38<00:40,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  49%|████████▎        | 77/157 [00:38<00:40,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▍        | 78/157 [00:39<00:39,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▌        | 79/157 [00:39<00:39,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  51%|████████▋        | 80/157 [00:40<00:38,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▊        | 81/157 [00:40<00:38,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▉        | 82/157 [00:41<00:37,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  53%|████████▉        | 83/157 [00:41<00:37,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████        | 84/157 [00:42<00:36,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████▏       | 85/157 [00:42<00:35,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▎       | 86/157 [00:42<00:35,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▍       | 87/157 [00:43<00:34,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  56%|█████████▌       | 88/157 [00:43<00:34,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 89/157 [00:44<00:33,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 90/157 [00:44<00:33,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  58%|█████████▊       | 91/157 [00:45<00:32,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|█████████▉       | 92/157 [00:45<00:32,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|██████████       | 93/157 [00:46<00:31,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  60%|██████████▏      | 94/157 [00:46<00:31,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▎      | 95/157 [00:47<00:30,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▍      | 96/157 [00:47<00:30,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 97/157 [00:48<00:29,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 98/157 [00:48<00:29,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  63%|██████████▋      | 99/157 [00:49<00:28,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▏     | 100/157 [00:49<00:28,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▎     | 101/157 [00:50<00:27,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  65%|██████████▍     | 102/157 [00:50<00:27,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▍     | 103/157 [00:51<00:26,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▌     | 104/157 [00:51<00:26,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  67%|██████████▋     | 105/157 [00:52<00:25,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▊     | 106/157 [00:52<00:25,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▉     | 107/157 [00:53<00:24,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 108/157 [00:53<00:24,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 109/157 [00:54<00:23,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  70%|███████████▏    | 110/157 [00:54<00:23,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▎    | 111/157 [00:55<00:22,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▍    | 112/157 [00:55<00:22,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  72%|███████████▌    | 113/157 [00:56<00:21,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▌    | 114/157 [00:56<00:21,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▋    | 115/157 [00:57<00:20,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  74%|███████████▊    | 116/157 [00:57<00:20,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|███████████▉    | 117/157 [00:58<00:19,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|████████████    | 118/157 [00:58<00:19,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 119/157 [00:59<00:18,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 120/157 [00:59<00:18,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  77%|████████████▎   | 121/157 [01:00<00:17,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▍   | 122/157 [01:00<00:17,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▌   | 123/157 [01:01<00:16,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  79%|████████████▋   | 124/157 [01:01<00:16,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▋   | 125/157 [01:02<00:15,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▊   | 126/157 [01:02<00:15,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  81%|████████████▉   | 127/157 [01:03<00:14,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████   | 128/157 [01:03<00:14,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████▏  | 129/157 [01:04<00:13,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▏  | 130/157 [01:04<00:13,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▎  | 131/157 [01:05<00:12,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  84%|█████████████▍  | 132/157 [01:05<00:12,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▌  | 133/157 [01:06<00:11,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▋  | 134/157 [01:06<00:11,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  86%|█████████████▊  | 135/157 [01:07<00:10,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▊  | 136/157 [01:07<00:10,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▉  | 137/157 [01:08<00:09,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  88%|██████████████  | 138/157 [01:08<00:09,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▏ | 139/157 [01:09<00:08,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▎ | 140/157 [01:09<00:08,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▎ | 141/157 [01:10<00:07,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▍ | 142/157 [01:10<00:07,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  91%|██████████████▌ | 143/157 [01:11<00:06,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▋ | 144/157 [01:11<00:06,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▊ | 145/157 [01:12<00:05,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  93%|██████████████▉ | 146/157 [01:12<00:05,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|██████████████▉ | 147/157 [01:13<00:04,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|███████████████ | 148/157 [01:13<00:04,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  95%|███████████████▏| 149/157 [01:13<00:03,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▎| 150/157 [01:14<00:03,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▍| 151/157 [01:15<00:02,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▍| 152/157 [01:15<00:02,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▌| 153/157 [01:15<00:01,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  98%|███████████████▋| 154/157 [01:16<00:01,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▊| 155/157 [01:17<00:00,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▉| 156/157 [01:17<00:00,  2.01it/s]\u001b[A\n",
      "Epoch 3: 100%|█| 351/351 [09:36<00:00,  1.64s/it, v_num=cj4f, val_loss=1.610, va\u001b[A\n",
      "Epoch 4: 100%|█| 351/351 [08:19<00:00,  1.42s/it, v_num=cj4f, val_loss=1.610, va\u001b[A\n",
      "Validation: 0it [00:00, ?it/s]\u001b[A\n",
      "Validation:   0%|                                       | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   0%|                          | 0/157 [00:00<?, ?it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|                  | 1/157 [00:00<01:28,  1.77it/s]\u001b[A\n",
      "Validation DataLoader 0:   1%|▏                 | 2/157 [00:01<01:19,  1.94it/s]\u001b[A\n",
      "Validation DataLoader 0:   2%|▎                 | 3/157 [00:01<01:16,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▍                 | 4/157 [00:01<01:14,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:   3%|▌                 | 5/157 [00:02<01:13,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▋                 | 6/157 [00:02<01:13,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:   4%|▊                 | 7/157 [00:03<01:12,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:   5%|▉                 | 8/157 [00:03<01:11,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                 | 9/157 [00:04<01:12,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:   6%|█                | 10/157 [00:04<01:11,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:   7%|█▏               | 11/157 [00:05<01:10,  2.06it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▎               | 12/157 [00:05<01:10,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:   8%|█▍               | 13/157 [00:06<01:09,  2.07it/s]\u001b[A\n",
      "Validation DataLoader 0:   9%|█▌               | 14/157 [00:06<01:08,  2.08it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▌               | 15/157 [00:07<01:09,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  10%|█▋               | 16/157 [00:07<01:09,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▊               | 17/157 [00:08<01:09,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  11%|█▉               | 18/157 [00:08<01:08,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  12%|██               | 19/157 [00:09<01:07,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▏              | 20/157 [00:09<01:07,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  13%|██▎              | 21/157 [00:10<01:06,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  14%|██▍              | 22/157 [00:10<01:05,  2.05it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▍              | 23/157 [00:11<01:06,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  15%|██▌              | 24/157 [00:11<01:05,  2.04it/s]\u001b[A\n",
      "Validation DataLoader 0:  16%|██▋              | 25/157 [00:12<01:05,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▊              | 26/157 [00:12<01:04,  2.02it/s]\u001b[A\n",
      "Validation DataLoader 0:  17%|██▉              | 27/157 [00:13<01:04,  2.03it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███              | 28/157 [00:13<01:04,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  18%|███▏             | 29/157 [00:14<01:04,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  19%|███▏             | 30/157 [00:15<01:03,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▎             | 31/157 [00:15<01:03,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  20%|███▍             | 32/157 [00:16<01:03,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  21%|███▌             | 33/157 [00:16<01:02,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▋             | 34/157 [00:17<01:01,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  22%|███▊             | 35/157 [00:17<01:01,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  23%|███▉             | 36/157 [00:18<01:00,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 37/157 [00:18<01:00,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  24%|████             | 38/157 [00:19<00:59,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▏            | 39/157 [00:19<00:59,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  25%|████▎            | 40/157 [00:20<00:59,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  26%|████▍            | 41/157 [00:20<00:58,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▌            | 42/157 [00:21<00:58,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  27%|████▋            | 43/157 [00:21<00:57,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  28%|████▊            | 44/157 [00:22<00:57,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▊            | 45/157 [00:22<00:56,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  29%|████▉            | 46/157 [00:23<00:56,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  30%|█████            | 47/157 [00:23<00:55,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▏           | 48/157 [00:24<00:55,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  31%|█████▎           | 49/157 [00:24<00:54,  1.97it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▍           | 50/157 [00:25<00:54,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  32%|█████▌           | 51/157 [00:25<00:53,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  33%|█████▋           | 52/157 [00:26<00:52,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▋           | 53/157 [00:26<00:52,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  34%|█████▊           | 54/157 [00:27<00:51,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  35%|█████▉           | 55/157 [00:27<00:51,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████           | 56/157 [00:28<00:50,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  36%|██████▏          | 57/157 [00:28<00:50,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  37%|██████▎          | 58/157 [00:29<00:49,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 59/157 [00:29<00:49,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  38%|██████▍          | 60/157 [00:30<00:48,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▌          | 61/157 [00:30<00:48,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  39%|██████▋          | 62/157 [00:31<00:47,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  40%|██████▊          | 63/157 [00:31<00:47,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|██████▉          | 64/157 [00:32<00:46,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  41%|███████          | 65/157 [00:32<00:46,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  42%|███████▏         | 66/157 [00:33<00:45,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 67/157 [00:33<00:45,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  43%|███████▎         | 68/157 [00:33<00:44,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  44%|███████▍         | 69/157 [00:34<00:43,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▌         | 70/157 [00:34<00:43,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  45%|███████▋         | 71/157 [00:35<00:42,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▊         | 72/157 [00:35<00:42,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  46%|███████▉         | 73/157 [00:36<00:41,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  47%|████████         | 74/157 [00:36<00:41,  2.01it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████         | 75/157 [00:37<00:40,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  48%|████████▏        | 76/157 [00:38<00:40,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  49%|████████▎        | 77/157 [00:38<00:39,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▍        | 78/157 [00:38<00:39,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  50%|████████▌        | 79/157 [00:39<00:39,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  51%|████████▋        | 80/157 [00:40<00:38,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▊        | 81/157 [00:40<00:38,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  52%|████████▉        | 82/157 [00:41<00:37,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  53%|████████▉        | 83/157 [00:41<00:37,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████        | 84/157 [00:42<00:36,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  54%|█████████▏       | 85/157 [00:42<00:36,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▎       | 86/157 [00:43<00:35,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  55%|█████████▍       | 87/157 [00:43<00:35,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  56%|█████████▌       | 88/157 [00:44<00:34,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 89/157 [00:44<00:34,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  57%|█████████▋       | 90/157 [00:45<00:33,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  58%|█████████▊       | 91/157 [00:45<00:33,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|█████████▉       | 92/157 [00:46<00:32,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  59%|██████████       | 93/157 [00:46<00:32,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  60%|██████████▏      | 94/157 [00:47<00:31,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▎      | 95/157 [00:47<00:31,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  61%|██████████▍      | 96/157 [00:48<00:30,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 97/157 [00:48<00:30,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  62%|██████████▌      | 98/157 [00:49<00:29,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  63%|██████████▋      | 99/157 [00:49<00:29,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▏     | 100/157 [00:50<00:28,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  64%|██████████▎     | 101/157 [00:50<00:28,  1.98it/s]\u001b[A\n",
      "Validation DataLoader 0:  65%|██████████▍     | 102/157 [00:51<00:27,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▍     | 103/157 [00:51<00:27,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  66%|██████████▌     | 104/157 [00:52<00:26,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  67%|██████████▋     | 105/157 [00:52<00:26,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▊     | 106/157 [00:53<00:25,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  68%|██████████▉     | 107/157 [00:53<00:25,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 108/157 [00:54<00:24,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  69%|███████████     | 109/157 [00:54<00:24,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  70%|███████████▏    | 110/157 [00:55<00:23,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▎    | 111/157 [00:55<00:23,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  71%|███████████▍    | 112/157 [00:56<00:22,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  72%|███████████▌    | 113/157 [00:56<00:22,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▌    | 114/157 [00:57<00:21,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  73%|███████████▋    | 115/157 [00:57<00:21,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  74%|███████████▊    | 116/157 [00:58<00:20,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|███████████▉    | 117/157 [00:58<00:20,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  75%|████████████    | 118/157 [00:59<00:19,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 119/157 [00:59<00:19,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  76%|████████████▏   | 120/157 [01:00<00:18,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  77%|████████████▎   | 121/157 [01:00<00:18,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▍   | 122/157 [01:01<00:17,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  78%|████████████▌   | 123/157 [01:01<00:17,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  79%|████████████▋   | 124/157 [01:02<00:16,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▋   | 125/157 [01:02<00:16,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  80%|████████████▊   | 126/157 [01:03<00:15,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  81%|████████████▉   | 127/157 [01:03<00:15,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████   | 128/157 [01:04<00:14,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  82%|█████████████▏  | 129/157 [01:04<00:14,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▏  | 130/157 [01:05<00:13,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  83%|█████████████▎  | 131/157 [01:05<00:13,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  84%|█████████████▍  | 132/157 [01:06<00:12,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▌  | 133/157 [01:06<00:12,  2.00it/s]\u001b[A\n",
      "Validation DataLoader 0:  85%|█████████████▋  | 134/157 [01:07<00:11,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  86%|█████████████▊  | 135/157 [01:07<00:11,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▊  | 136/157 [01:08<00:10,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  87%|█████████████▉  | 137/157 [01:08<00:10,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  88%|██████████████  | 138/157 [01:09<00:09,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▏ | 139/157 [01:09<00:09,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  89%|██████████████▎ | 140/157 [01:10<00:08,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▎ | 141/157 [01:10<00:08,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  90%|██████████████▍ | 142/157 [01:11<00:07,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  91%|██████████████▌ | 143/157 [01:11<00:07,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▋ | 144/157 [01:12<00:06,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  92%|██████████████▊ | 145/157 [01:12<00:06,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  93%|██████████████▉ | 146/157 [01:13<00:05,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|██████████████▉ | 147/157 [01:13<00:05,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  94%|███████████████ | 148/157 [01:14<00:04,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  95%|███████████████▏| 149/157 [01:14<00:04,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▎| 150/157 [01:15<00:03,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  96%|███████████████▍| 151/157 [01:15<00:03,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▍| 152/157 [01:16<00:02,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  97%|███████████████▌| 153/157 [01:16<00:02,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  98%|███████████████▋| 154/157 [01:17<00:01,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▊| 155/157 [01:17<00:01,  1.99it/s]\u001b[A\n",
      "Validation DataLoader 0:  99%|███████████████▉| 156/157 [01:18<00:00,  1.99it/s]\u001b[A\n",
      "Epoch 4: 100%|█| 351/351 [09:37<00:00,  1.65s/it, v_num=cj4f, val_loss=1.570, va\u001b[A\n",
      "Epoch 4: 100%|█| 351/351 [09:37<00:00,  1.65s/it, v_num=cj4f, val_loss=1.570, va\u001b[A"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "`Trainer.fit` stopped: `max_epochs=5` reached.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 4: 100%|█| 351/351 [09:37<00:00,  1.65s/it, v_num=cj4f, val_loss=1.570, va\n"
     ]
    }
   ],
   "source": [
    "# Entrena el modelo\n",
    "trainer.fit(model, dm)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dc40b98b-522c-4d6d-895c-eb65c394862c",
   "metadata": {},
   "source": [
    "### <span style=\"color:#4CC9F0\">Evalua el modelo</span>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "f6781480-fdd4-483d-adcf-4c3b01ba34fa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Files already downloaded and verified\n",
      "Files already downloaded and verified\n",
      "Testing DataLoader 0: 100%|███████████████████| 313/313 [02:24<00:00,  2.16it/s]\n",
      "────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
      "Runningstage.testing metric      DataLoader 0\n",
      "────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
      "        test_acc             0.439300000667572\n",
      "        test_loss           1.5343555212020874\n",
      "────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[{'test_loss': 1.5343555212020874, 'test_acc': 0.439300000667572}]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Evalua el modelo en el conjunto de prueba retenido\n",
    "trainer.test(model,dm)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "192c4f90-014d-4176-be5f-b8904dcea1f5",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}