From c63bb1b3e394133c08e2087a5db3c6753609a0d1 Mon Sep 17 00:00:00 2001 From: Anish Shah Date: Mon, 4 Dec 2023 17:03:46 -0500 Subject: [PATCH] Update fine tuning ptl notebook --- ..._a_Transformer_with_Pytorch_Lightning.ipynb | 18 +++++++++++++++--- ...lassification_using_PyTorch_Lightning.ipynb | 14 +++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/colabs/pytorch-lightning/Fine_tuning_a_Transformer_with_Pytorch_Lightning.ipynb b/colabs/pytorch-lightning/Fine_tuning_a_Transformer_with_Pytorch_Lightning.ipynb index 9a2a1f10..0f91a0c9 100644 --- a/colabs/pytorch-lightning/Fine_tuning_a_Transformer_with_Pytorch_Lightning.ipynb +++ b/colabs/pytorch-lightning/Fine_tuning_a_Transformer_with_Pytorch_Lightning.ipynb @@ -64,7 +64,7 @@ "outputs": [], "source": [ "# Install some dependencies\n", - "!pip install pandas torch pytorch-lightning transformers==4.1.1 -q\n", + "!pip install pandas torch lightning transformers\n", "!pip install -Uq wandb" ] }, @@ -81,7 +81,7 @@ "import transformers\n", "import numpy as np\n", "import pandas as pd\n", - "import pytorch_lightning as pl" + "import lightning.pytorch as pl" ] }, { @@ -426,7 +426,7 @@ " gpus = -1 if torch.cuda.is_available() else 0\n", " \n", " # Construct a Trainer object with the W&B logger we created and epoch set by the config object\n", - " trainer = pl.Trainer(max_epochs=config.epochs, gpus=gpus, logger=logger)\n", + " trainer = pl.Trainer(max_epochs=config.epochs, logger=logger)\n", " \n", " # Build data loaders for our datasets, using the batch_size from our config object\n", " train_data_loader = torch.utils.data.DataLoader(train_dataset, batch_size=config.batch_size)\n", @@ -536,6 +536,18 @@ "kernelspec": { "display_name": "Python 3", "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.2" } }, "nbformat": 4, diff --git a/colabs/pytorch-lightning/Image_Classification_using_PyTorch_Lightning.ipynb b/colabs/pytorch-lightning/Image_Classification_using_PyTorch_Lightning.ipynb index f8ddb4df..82c9402b 100644 --- a/colabs/pytorch-lightning/Image_Classification_using_PyTorch_Lightning.ipynb +++ b/colabs/pytorch-lightning/Image_Classification_using_PyTorch_Lightning.ipynb @@ -46,7 +46,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install lightning -q\n", + "!pip install lightning torchvision -q\n", "# install weights and biases\n", "!pip install wandb -qU" ] @@ -452,6 +452,18 @@ "kernelspec": { "display_name": "Python 3", "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.2" } }, "nbformat": 4,