Is there a way to use the PyTorch profiler when using Amazon SageMaker? Or can we call PyTorch profiler in the profiler config for SageMaker debugger
How can you use PyTorch Profiler on SageMaker?
192 Views Asked by Philipp Schmid At
2
There are 2 best solutions below
0
On
To use the PyTorch vanilla profiler in SageMaker Training jobs:
- On the SageMaker Estimator turn off the SageMaker built-in profiler (as you'll be using the PT Vanilla profiler):
estimator = PyTorch(..., disable_profiler=True, ...) - In your training script add PT profiler as shown in this PT Profiler with TensorBoard tutorial.
- Export the profiling data to SageMaker managed output folder:
on_trace_ready=torch.profiler.tensorboard_trace_handler(f'{args.output_data_dir}/profile') - when the job completes. Start TensorBoard with the S3 location of the output data folder:
estimator.latest_job_tensorboard_artifacts_path()
You can use the below snippet to initiate a Profiler .
Then you can pass the
profilfer_configto thePytorchestimator.