From 08221e1cc12f22da1e9749e33c123a72dc76a44d Mon Sep 17 00:00:00 2001 From: Maciej Szankin Date: Fri, 22 Dec 2023 15:09:16 +0100 Subject: [PATCH] Update example notebooks for search with DyNAS-T (#1480) Signed-off-by: Maciej Szankin --- .../dynas/BERT_SST2_Supernet_NAS.ipynb | 6 +-- ...MobileNetV3_Supernet_Distributed_NAS.ipynb | 53 ++++++++++++++++++- .../dynas/MobileNetV3_Supernet_NAS.ipynb | 6 +-- ...et50_Quantiation_Search_Supernet_NAS.ipynb | 20 ++----- 4 files changed, 61 insertions(+), 24 deletions(-) diff --git a/examples/notebook/dynas/BERT_SST2_Supernet_NAS.ipynb b/examples/notebook/dynas/BERT_SST2_Supernet_NAS.ipynb index d479b443a23..604211ce32c 100644 --- a/examples/notebook/dynas/BERT_SST2_Supernet_NAS.ipynb +++ b/examples/notebook/dynas/BERT_SST2_Supernet_NAS.ipynb @@ -40,7 +40,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip -q install neural_compressor dynast==1.1.0" + "!pip -q install neural_compressor dynast==1.5.2" ] }, { @@ -59,7 +59,7 @@ "# import sys\n", "# sys.path.insert(0,'')\n", "# !pip install -qr /requirements.txt\n", - "# !pip install -q dynast==1.1.0" + "# !pip install -q dynast==1.5.2" ] }, { @@ -251,7 +251,7 @@ "cm = plt.cm.get_cmap('viridis_r')\n", "count = [x for x in range(len(df_dynas))]\n", "\n", - "ax.scatter(df_dynas['macs'].values, df_dynas['acc'].values, marker='^', alpha=0.8, c=count, \n", + "ax.scatter(df_dynas['macs'].values, df_dynas['acc'].values, marker='^', alpha=0.8, c=count,\n", " cmap=cm, label='Discovered DNN Model', s=10)\n", "ax.set_title(f'Intel® Neural Compressor\\nDynamic NAS (DyNAS)\\nSupernet:{config.dynas.supernet}')\n", "ax.set_xlabel('MACs', fontsize=13)\n", diff --git a/examples/notebook/dynas/MobileNetV3_Supernet_Distributed_NAS.ipynb b/examples/notebook/dynas/MobileNetV3_Supernet_Distributed_NAS.ipynb index f5b477274a9..886fc401d1a 100644 --- a/examples/notebook/dynas/MobileNetV3_Supernet_Distributed_NAS.ipynb +++ b/examples/notebook/dynas/MobileNetV3_Supernet_Distributed_NAS.ipynb @@ -17,6 +17,55 @@ "## Prerequisites" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Install Intel® MPI or OpenMPI\n", + "\n", + "#### Intel® MPI\n", + "\n", + "Please refer to [Intel® MPI Library](https://www.intel.com/content/www/us/en/developer/tools/oneapi/mpi-library.html#gs.1t0vm0) for detailed steps on how to install Intel® MPI.\n", + "\n", + "#### OpenMPI\n", + "\n", + "1. You can download OpenMPI from https://www.open-mpi.org/ or use this link to directly download version 4.1.5:\n", + "\n", + " ```bash\n", + " wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.5.tar.gz\n", + " ```\n", + "\n", + "1. Unpack OpenMPI source code and go to source directory:\n", + "\n", + " ```bash\n", + " tar -xzf openmpi-4.1.5.tar.gz\n", + " cd openmpi-4.1.5\n", + " ```\n", + "\n", + "1. Configure, compile and install by executing the following command (change directory if needed):\n", + "\n", + " ```bash\n", + " ./configure --prefix=/opt/openmpi\n", + " make -j $(($(nproc)/2)) all\n", + " make install\n", + " ```\n", + "\n", + "1. To use OpenMPI you will have to change your PATH and LD_LIBRARY_PATH environment variables (change directory if needed):\n", + "\n", + " ```bash\n", + " echo \"export PATH=$PATH:/opt/openmpi/bin\" >> $HOME/.bashrc\n", + " echo \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/openmpi/lib\" >> $HOME/.bashrc\n", + " ```\n", + "\n", + "1. Cleanup\n", + "\n", + " ```bash\n", + " cd ../\n", + " rm openmpi-4.1.5.tar.gz\n", + " rm -Rf openmpi-4.1.5\n", + " ```" + ] + }, { "cell_type": "code", "execution_count": null, @@ -91,7 +140,7 @@ ], "metadata": { "kernelspec": { - "display_name": "dynast_inc_pip_test", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -105,7 +154,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.10.13" }, "vscode": { "interpreter": { diff --git a/examples/notebook/dynas/MobileNetV3_Supernet_NAS.ipynb b/examples/notebook/dynas/MobileNetV3_Supernet_NAS.ipynb index edc6e09537f..d678c1c13da 100644 --- a/examples/notebook/dynas/MobileNetV3_Supernet_NAS.ipynb +++ b/examples/notebook/dynas/MobileNetV3_Supernet_NAS.ipynb @@ -38,7 +38,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip -q install neural_compressor dynast==1.1.0" + "!pip -q install neural_compressor dynast==1.5.2 gdown" ] }, { @@ -57,7 +57,7 @@ "# import sys\n", "# sys.path.insert(0,'')\n", "# !pip install -qr /requirements.txt\n", - "# !pip install -q dynast==1.1.0" + "# !pip install -q dynast==1.5.2 gdown" ] }, { @@ -245,7 +245,7 @@ "cm = plt.cm.get_cmap('viridis_r')\n", "count = [x for x in range(len(df_dynas))]\n", "\n", - "ax.scatter(df_dynas['macs'].values, df_dynas['top1'].values, marker='^', alpha=0.8, c=count, \n", + "ax.scatter(df_dynas['macs'].values, df_dynas['top1'].values, marker='^', alpha=0.8, c=count,\n", " cmap=cm, label='Discovered DNN Model', s=10)\n", "ax.set_title(f'Intel® Neural Compressor\\nDynamic NAS (DyNAS)\\nSupernet:{config.dynas.supernet}')\n", "ax.set_xlabel('MACs', fontsize=13)\n", diff --git a/examples/notebook/dynas/ResNet50_Quantiation_Search_Supernet_NAS.ipynb b/examples/notebook/dynas/ResNet50_Quantiation_Search_Supernet_NAS.ipynb index 9af1bc8a4cf..f1a8c9b5a09 100644 --- a/examples/notebook/dynas/ResNet50_Quantiation_Search_Supernet_NAS.ipynb +++ b/examples/notebook/dynas/ResNet50_Quantiation_Search_Supernet_NAS.ipynb @@ -38,7 +38,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip -q install neural_compressor dynast==1.5.1" + "!pip -q install neural_compressor dynast==1.5.2" ] }, { @@ -57,7 +57,7 @@ "# import sys\n", "# sys.path.insert(0,'')\n", "# !pip install -qr /requirements.txt\n", - "# !pip install -q dynast==1.5.1" + "# !pip install -q dynast==1.5.2" ] }, { @@ -247,7 +247,7 @@ "cm = plt.cm.get_cmap('viridis_r')\n", "count = [x for x in range(len(df_dynas))]\n", "\n", - "ax.scatter(df_dynas['lat'].values, df_dynas['top1'].values, marker='^', alpha=0.8, c=count, \n", + "ax.scatter(df_dynas['lat'].values, df_dynas['top1'].values, marker='^', alpha=0.8, c=count,\n", " cmap=cm, label='Discovered DNN Model', s=10)\n", "ax.set_title(f'Intel® Neural Compressor\\nDynamic NAS (DyNAS)\\nSupernet:{config.dynas.supernet}')\n", "ax.set_xlabel('Latency (normalized)', fontsize=13)\n", @@ -289,22 +289,10 @@ ], "metadata": { "kernelspec": { - "display_name": "dynast_inc_pip_test", + "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.10.12" - }, "vscode": { "interpreter": { "hash": "034f8a08a724a63543abaa4596714d81bf71b36e8b4dd0d5bf824a9fea1bc071"