LLMs-from-scratch icon indicating copy to clipboard operation
LLMs-from-scratch copied to clipboard

suggestion of adding torch.profile

Open frankchieng opened this issue 1 year ago • 0 comments

i just check out the code of appendix-A/01_main-chapter-code /DDP-script.py,how about adding

from torch.profiler import profile
with profile() as prof:
    #the main function training code
if rank == 0:
    print("exporting trace")
    prof.export_chrome_trace("trace_ddp_simple.json")

than we can see the tracing profiling json file in google Chrome

frankchieng avatar May 07 '24 07:05 frankchieng