#log-parser #logs #pytorch #compile #data #produced #torch

bin+lib tlparse

Parse TORCH_LOG logs produced by PyTorch torch.compile

14 releases

0.3.20 May 27, 2024
0.3.19 May 21, 2024
0.3.15 Apr 24, 2024
0.3.11 Mar 26, 2024
0.1.0 Feb 11, 2024

#125 in Machine learning

Download history 357/week @ 2024-02-23 26/week @ 2024-03-01 3/week @ 2024-03-08 466/week @ 2024-03-22 175/week @ 2024-03-29 124/week @ 2024-04-05 87/week @ 2024-04-12 398/week @ 2024-04-19 362/week @ 2024-04-26 135/week @ 2024-05-03 75/week @ 2024-05-10 329/week @ 2024-05-17 242/week @ 2024-05-24 144/week @ 2024-05-31 60/week @ 2024-06-07

795 downloads per month

BSD-3-Clause

63KB
1.5K SLoC

tlparse: Parse structured PT2 logs

tlparse parses structured torch trace logs and outputs HTML files analyzing data.

Quick start: Run PT2 with the TORCH_TRACE environment variable set:

TORCH_TRACE=/tmp/my_traced_log example.py

Feed input into tlparse:

tlparse /tmp/my_traced_log -o tl_out/

Adding custom parsers

You can extend tlparse with custom parsers which take existing structured log data and output any file. To do so, first implement StructuredLogParser with your own trait:

pub struct MyCustomParser;
impl StructuredLogParser for MyCustomParser {
    fn name(&self) -> &'static str {
        "my_custom_parser"
    }
    fn get_metadata<'e>(&self, e: &'e Envelope) -> Option<Metadata<'e>> {
        // Get required metadata from the Envelope.
        // You'll need to update Envelope with your custom Metadata if you need new types here
        ....
    }

    fn parse<'e>(&self,
        lineno: usize,
        metadata: Metadata<'e>,
        _rank: Option<u32>,
        compile_id: &Option<CompileId>,
        payload: &str
    ) -> anyhow::Result<ParserResult> {
       // Use the metadata and payload however you'd like
       // Return either a ParserOutput::File(filename, payload) or ParserOutput::Link(name, url)
    }
}

Dependencies

~9–19MB
~234K SLoC