#logging #pytorch #log-parser #compile #process

bin+lib tlparse

Parse TORCH_LOG logs produced by PyTorch torch.compile

47 releases

new 0.4.7 Feb 9, 2026
0.4.4 Dec 30, 2025
0.4.3 Sep 12, 2025
0.3.44 May 27, 2025
0.3.11 Mar 26, 2024

#305 in Machine learning

Download history 140/week @ 2025-10-20 227/week @ 2025-10-27 464/week @ 2025-11-03 167/week @ 2025-11-10 210/week @ 2025-11-17 191/week @ 2025-11-24 176/week @ 2025-12-01 192/week @ 2025-12-08 95/week @ 2025-12-15 80/week @ 2025-12-22 51/week @ 2025-12-29 145/week @ 2026-01-05 217/week @ 2026-01-12 311/week @ 2026-01-19 395/week @ 2026-01-26 433/week @ 2026-02-02

1,374 downloads per month

BSD-3-Clause

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

Feed input into tlparse (this will process the latest log file in the directory):

tlparse /tmp/my_traced_log_dir -o tl_out/ --latest

You can also specify a log filename:

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

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–23MB
~266K SLoC