Skip to content

Support new tensorboard-plugin-profile v2.22+ import path (xprof) #648

Description

@joyjie818

Summary

The latest version of tensorboard-plugin-profile (v2.22+) has changed its module structure. The convert module is now imported from xprof instead of tensorboard_plugin_profile.convert, causing ModuleNotFoundError when loading .pb files.

Error

File "TraceLens/util.py", line 34, in load_data from tensorboard_plugin_profile.convert import raw_to_tool_data as convert ModuleNotFoundError: No module named 'tensorboard_plugin_profile.convert'

Root Cause

In tensorboard-plugin-profile v2.22+, the package is a passthrough to xprof:

# tensorboard_plugin_profile/__init__.py
from xprof import convert
...
The correct import is now from xprof.convert import raw_to_tool_data.

Proposed Fix
Update TraceLens/util.py line 34:

# Before:
from tensorboard_plugin_profile.convert import raw_to_tool_data as convert
# After:
try:
    from tensorboard_plugin_profile.convert import raw_to_tool_data as convert
except (ImportError, ModuleNotFoundError):
    from xprof.convert import raw_to_tool_data as convert
Environment
tensorboard-plugin-profile==2.22.1
xprof==2.22.1
Python 3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions