Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python ILogger Subclassing example does not work #2253

Closed
dlangerm opened this issue Aug 17, 2022 · 7 comments
Closed

Python ILogger Subclassing example does not work #2253

dlangerm opened this issue Aug 17, 2022 · 7 comments
Assignees
Labels
triaged Issue has been triaged by maintainers

Comments

@dlangerm
Copy link

Description

The example here is below

from tensorrt import tensorrt as trt

class MyLogger(trt.ILogger):
    def __init__(self):
        trt.ILogger.__init__(self)

    def log(self, severity, msg):
        return

MyLogger()

Unfortunately, this raises

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-4b669386d283> in <module>
      9 
     10 
---> 11 MyLogger()

<ipython-input-6-4b669386d283> in __init__(self)
      3 class MyLogger(trt.ILogger):
      4     def __init__(self):
----> 5         trt.ILogger.__init__(self)
      6 
      7     def log(self, severity, msg):

TypeError: MyLogger: No constructor defined!

I'm not really sure where to go from here. I've tried various import schemes and they all either raise the same error or don't do anything at all.

Environment

TensorRT Version: 7.2.1.6
Operating System: Ubuntu Linux 22.04
Python Version (if applicable): 3.6
Baremetal or Container (if so, version): Container (base: nvcr.io/nvidia/pytorch:20.11-py3 )

Relevant Files

Code snippet above is all you need

Steps To Reproduce

Run the above code snippet

@pranavm-nvidia
Copy link
Collaborator

Looks like you're referring to the 8.4.2 docs. Can you try upgrading your TensorRT version?

@zerollzeng zerollzeng added the triaged Issue has been triaged by maintainers label Aug 18, 2022
@dlangerm
Copy link
Author

@pranavm-nvidia ah good catch, I'll try that today and let you know.

@dlangerm
Copy link
Author

@pranavm-nvidia unfortunately it seems that since this system is meant to be deployed on a Jetson I cannot upgrade the tensorrt version for my testing (which produced the error above) beyond what the target device is capable of (the target is running jetpack 4.5 meaning the trt version is 7.1) Upgrading the jetpack version on the device is not possible.

Reference:
https://forums.developer.nvidia.com/t/how-to-upgrade-tensorrt-to-7-0-version/110231/5

@pranavm-nvidia
Copy link
Collaborator

Unfortunately, this API wasn't exposed in TRT 7, so I don't think there's much you can do short of upgrading.

@dlangerm
Copy link
Author

@pranavm-nvidia ah that's unfortunate. Do you know where I might be able to start if I wanted to work around this? Perhaps some kind of context manager to redirect the logger output?

@pranavm-nvidia
Copy link
Collaborator

The logger output would go directly to stdout/stderr, so you'd have to capture it from there. What are you looking to do exactly? Is post-processing the logs an option?

@ttyio
Copy link
Collaborator

ttyio commented Nov 29, 2022

closing due to no activity for more than 3 weeks, please reopen if you still have question, thanks!

@ttyio ttyio closed this as completed Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

4 participants