35 releases

0.3.41 Apr 21, 2025
0.3.39 Mar 27, 2025
0.3.30 Dec 5, 2024
0.3.29 Nov 21, 2024
0.3.11 Mar 26, 2024

#727 in Template engine

Download history 39/week @ 2025-01-08 55/week @ 2025-01-15 381/week @ 2025-01-22 454/week @ 2025-01-29 129/week @ 2025-02-05 260/week @ 2025-02-12 269/week @ 2025-02-19 145/week @ 2025-02-26 183/week @ 2025-03-05 470/week @ 2025-03-12 310/week @ 2025-03-19 460/week @ 2025-03-26 177/week @ 2025-04-02 127/week @ 2025-04-09 393/week @ 2025-04-16 277/week @ 2025-04-23

1,008 downloads per month

BSD-3-Clause

450KB
3K SLoC

Rust 3K SLoC // 0.0% comments JavaScript 344 SLoC // 0.2% comments

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–20MB
~258K SLoC