From e58d49454c92986a1d2a6a48add2333bbfbeaf51 Mon Sep 17 00:00:00 2001 From: neverix Date: Mon, 11 Apr 2022 00:08:16 +0300 Subject: [PATCH] use pkg_resources for PyTorch version checks in notebooks (#191) * use pkg_resources for PyTorch version checks in notebooks * remove version checking in notebook code cell Co-authored-by: Jong Wook Kim --- notebooks/Interacting_with_CLIP.ipynb | 5 ++--- notebooks/Prompt_Engineering_for_ImageNet.ipynb | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/notebooks/Interacting_with_CLIP.ipynb b/notebooks/Interacting_with_CLIP.ipynb index b13a90e..1043f23 100644 --- a/notebooks/Interacting_with_CLIP.ipynb +++ b/notebooks/Interacting_with_CLIP.ipynb @@ -352,10 +352,9 @@ "source": [ "import numpy as np\n", "import torch\n", + "from pkg_resources import packaging\n", "\n", - "print(\"Torch version:\", torch.__version__)\n", - "\n", - "assert torch.__version__.split(\".\") >= [\"1\", \"7\", \"1\"], \"PyTorch 1.7.1 or later is required\"" + "print(\"Torch version:\", torch.__version__)\n" ], "execution_count": 2, "outputs": [ diff --git a/notebooks/Prompt_Engineering_for_ImageNet.ipynb b/notebooks/Prompt_Engineering_for_ImageNet.ipynb index 1dde052..dba7fb6 100644 --- a/notebooks/Prompt_Engineering_for_ImageNet.ipynb +++ b/notebooks/Prompt_Engineering_for_ImageNet.ipynb @@ -588,10 +588,9 @@ "import torch\n", "import clip\n", "from tqdm.notebook import tqdm\n", + "from pkg_resources import packaging\n", "\n", - "print(\"Torch version:\", torch.__version__)\n", - "\n", - "assert torch.__version__.split(\".\") >= [\"1\", \"7\", \"1\"], \"PyTorch 1.7.1 or later is required\"" + "print(\"Torch version:\", torch.__version__)\n" ], "execution_count": 2, "outputs": [ @@ -1105,4 +1104,4 @@ ] } ] -} \ No newline at end of file +}