Skip to main content

Parse TORCH_LOG logs produced by PyTorch torch.compile

Project description

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
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tlparse-0.3.18.tar.gz (32.3 kB view hashes)

Uploaded Source

Built Distributions

tlparse-0.3.18-py3-none-win_amd64.whl (1.1 MB view hashes)

Uploaded Python 3 Windows x86-64

tlparse-0.3.18-py3-none-win32.whl (1.0 MB view hashes)

Uploaded Python 3 Windows x86

tlparse-0.3.18-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

tlparse-0.3.18-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.5 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ s390x

tlparse-0.3.18-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.3 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64le

tlparse-0.3.18-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (2.3 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ i686

tlparse-0.3.18-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.1 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ARMv7l

tlparse-0.3.18-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.2 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

tlparse-0.3.18-py3-none-macosx_11_0_arm64.whl (1.3 MB view hashes)

Uploaded Python 3 macOS 11.0+ ARM64

tlparse-0.3.18-py3-none-macosx_10_12_x86_64.whl (1.4 MB view hashes)

Uploaded Python 3 macOS 10.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page