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

bin+lib tlparse

Parse TORCH_LOG logs produced by PyTorch torch.compile

11 releases

new 0.3.15 Apr 24, 2024
0.3.14 Apr 22, 2024
0.3.11 Mar 26, 2024
0.3.2 Feb 25, 2024
0.1.0 Feb 11, 2024

#111 in Machine learning

Download history 3/week @ 2024-02-10 162/week @ 2024-02-17 209/week @ 2024-02-24 15/week @ 2024-03-02 2/week @ 2024-03-09 468/week @ 2024-03-23 214/week @ 2024-03-30 117/week @ 2024-04-06 65/week @ 2024-04-13 409/week @ 2024-04-20

807 downloads per month

BSD-3-Clause

48KB
1K 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–18MB
~224K SLoC