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

bin+lib tlparse

Parse TORCH_LOG logs produced by PyTorch torch.compile

12 releases

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

#103 in Machine learning

Download history 2/week @ 2024-02-09 3/week @ 2024-02-16 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 44/week @ 2024-05-10

944 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
~221K SLoC