mindx_elastic.api.patch_torch_methods (for Internal Use Only)
Description
When the sed -i '/import os/i import mindx_elastic.api' $(pip3.7 show torch | grep Location | awk -F ' ' '{print $2}')/torch/distributed/run.py command is executed during Elastic Agent installation via a training image, the mindx_elastic.api.patch_torch_methods API is executed by Elastic Agent when it imports the elastic module of Torch, so that patch takes effect automatically.
Elastic Agent patches the torch.distributed.elastic.agent.server.api.SimpleElasticAgent._invoke_run, torch.distributed.launcher.api.launch_agent, and torch.distributed.elastic.agent.server.api.SimpleElasticAgent._initialize_workers methods, and provides the fault detection and recovery function for Ascend NPUs.
Parent topic: Elastic Agent (APIs Related to Resumable Training)