Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes some runtime issues for perf profiling notebook on Intel Tiber AI Cloud #101

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions PyTorch/Profiling_and_Optimization/Profiler_and_Optimization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@
"The collected trace files will be saved to ./hpu_profile"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c97a9142-a80e-4c4f-82b7-4f08509996c5",
"metadata": {},
"outputs": [],
"source": [
"from optimum.habana.utils import HabanaProfile\n",
"HabanaProfile.enable()"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -202,7 +213,7 @@
}
],
"source": [
"!python run_image_classification.py \\\n",
"%run run_image_classification.py \\\n",
" --model_name_or_path microsoft/swin-base-patch4-window7-224-in22k \\\n",
" --dataset_name cifar10 \\\n",
" --output_dir /tmp/outputs/ \\\n",
Expand Down Expand Up @@ -233,7 +244,17 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "4f029263-187b-46be-b017-09c5be1ef8dc",
"metadata": {},
"outputs": [],
"source": [
"!mv ./hpu_profile/*.pt.trace.json ./hpu_profile/UNOPT.pt.trace.json"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "f23106fe-e911-4e67-9c8f-4ad8d587408e",
"metadata": {},
"outputs": [
Expand All @@ -251,8 +272,7 @@
}
],
"source": [
"%cd hpu_profile\n",
"%ls -al"
"%ls -al hpu_profile"
]
},
{
Expand Down Expand Up @@ -303,7 +323,7 @@
],
"source": [
"%load_ext tensorboard\n",
"%tensorboard --logdir=~/optimum-habana/examples/image-classification/hpu_profile --port 6006 # Your port selection may vary, default is 6006"
"%tensorboard --logdir=./hpu_profile --port 6006 # Your port selection may vary, default is 6006"
]
},
{
Expand Down Expand Up @@ -348,7 +368,7 @@
}
],
"source": [
"!habana_perf_tool --trace /root/optimum-habana/examples/image-classification/hpu_profile/sc09wynn05-hls2_14734.1729284340533778439.pt.trace.json"
"!habana_perf_tool --trace ./hpu_profile/UNOPT.pt.trace.json"
]
},
{
Expand Down Expand Up @@ -381,9 +401,18 @@
}
],
"source": [
"%cd ..\n",
"!hl-prof-config -e off -phase=multi-enq -g 1-20 -s my_profiling_session\n",
"!export HABANA_PROFILE=1"
"!hl-prof-config -e off -phase=multi-enq -g 1-20 -s my_profiling_session"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1eb9fe7f-5817-4803-90b8-244da14213c0",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"os.environ[\"HABANA_PROFILE\"] = \"1\""
]
},
{
Expand All @@ -393,7 +422,7 @@
"metadata": {},
"outputs": [],
"source": [
"!HABANA_PROFILE=1 python run_image_classification.py \\\n",
"%run run_image_classification.py \\\n",
" --model_name_or_path microsoft/swin-base-patch4-window7-224-in22k \\\n",
" --dataset_name cifar10 \\\n",
" --output_dir /tmp/outputs/ \\\n",
Expand Down