#logging #pytorch #parser #compile #html #producing

bin+lib tlparse

Parse TORCH_LOG logs produced by PyTorch torch.compile

43 releases

new 0.4.3 Sep 12, 2025
0.4.0 Aug 21, 2025
0.3.44 May 27, 2025
0.3.39 Mar 27, 2025
0.3.11 Mar 26, 2024

#206 in Machine learning

Download history 590/week @ 2025-05-21 307/week @ 2025-05-28 187/week @ 2025-06-04 206/week @ 2025-06-11 300/week @ 2025-06-18 303/week @ 2025-06-25 272/week @ 2025-07-02 628/week @ 2025-07-09 342/week @ 2025-07-16 326/week @ 2025-07-23 199/week @ 2025-07-30 170/week @ 2025-08-06 154/week @ 2025-08-13 525/week @ 2025-08-20 137/week @ 2025-08-27 439/week @ 2025-09-03

1,313 downloads per month

BSD-3-Clause

6MB
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_dir example.py

Feed input into tlparse:

tlparse /tmp/my_traced_log_dir -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)
    }
}

How to release

  1. Make a release commit by updating Cargo.toml and then running cargo update
  2. Push the release commit and a tag for it. This will trigger PyPI release
  3. cargo publish

Dependencies

~10–21MB
~268K SLoC