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

bin+lib tlparse

Parse TORCH_LOG logs produced by PyTorch torch.compile

12 releases

new 0.3.17 May 1, 2024
0.3.16 May 1, 2024
0.3.15 Apr 24, 2024
0.3.11 Mar 26, 2024
0.1.0 Feb 11, 2024

#112 in Machine learning

Download history 1/week @ 2024-02-08 4/week @ 2024-02-15 352/week @ 2024-02-22 30/week @ 2024-02-29 4/week @ 2024-03-07 444/week @ 2024-03-21 123/week @ 2024-03-28 174/week @ 2024-04-04 106/week @ 2024-04-11 337/week @ 2024-04-18 332/week @ 2024-04-25

974 downloads per month

BSD-3-Clause

55KB
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<ParseOutput> {
       // Use the metadata and payload however you'd like
    }
}

Dependencies

~7–17MB
~220K SLoC