Skip to content

Commit

Permalink
Update example notebooks for search with DyNAS-T (#1480)
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Szankin <maciej.szankin@intel.com>
  • Loading branch information
macsz committed Dec 22, 2023
1 parent 9600e1d commit 08221e1
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 24 deletions.
6 changes: 3 additions & 3 deletions examples/notebook/dynas/BERT_SST2_Supernet_NAS.ipynb
Expand Up @@ -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"
]
},
{
Expand All @@ -59,7 +59,7 @@
"# import sys\n",
"# sys.path.insert(0,'<path to neural compressor>')\n",
"# !pip install -qr <path to neural compressor>/requirements.txt\n",
"# !pip install -q dynast==1.1.0"
"# !pip install -q dynast==1.5.2"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down
53 changes: 51 additions & 2 deletions examples/notebook/dynas/MobileNetV3_Supernet_Distributed_NAS.ipynb
Expand Up @@ -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,
Expand Down Expand Up @@ -91,7 +140,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "dynast_inc_pip_test",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -105,7 +154,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.10.13"
},
"vscode": {
"interpreter": {
Expand Down
6 changes: 3 additions & 3 deletions examples/notebook/dynas/MobileNetV3_Supernet_NAS.ipynb
Expand Up @@ -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"
]
},
{
Expand All @@ -57,7 +57,7 @@
"# import sys\n",
"# sys.path.insert(0,'<path to neural compressor>')\n",
"# !pip install -qr <path to neural compressor>/requirements.txt\n",
"# !pip install -q dynast==1.1.0"
"# !pip install -q dynast==1.5.2 gdown"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down
Expand Up @@ -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"
]
},
{
Expand All @@ -57,7 +57,7 @@
"# import sys\n",
"# sys.path.insert(0,'<path to neural compressor>')\n",
"# !pip install -qr <path to neural compressor>/requirements.txt\n",
"# !pip install -q dynast==1.5.1"
"# !pip install -q dynast==1.5.2"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 08221e1

Please sign in to comment.