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

bin+lib tlparse

Parse TORCH_LOG logs produced by PyTorch torch.compile

16 releases

0.3.22 Jul 15, 2024
0.3.21 Jul 3, 2024
0.3.20 May 27, 2024
0.3.15 Apr 24, 2024
0.1.0 Feb 11, 2024

#165 in Machine learning

Download history 200/week @ 2024-04-01 118/week @ 2024-04-08 48/week @ 2024-04-15 427/week @ 2024-04-22 382/week @ 2024-04-29 89/week @ 2024-05-06 97/week @ 2024-05-13 352/week @ 2024-05-20 230/week @ 2024-05-27 130/week @ 2024-06-03 61/week @ 2024-06-10 33/week @ 2024-06-17 89/week @ 2024-06-24 218/week @ 2024-07-01 72/week @ 2024-07-08 240/week @ 2024-07-15

622 downloads per month

BSD-3-Clause

73KB
2K 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
~229K SLoC