Skip to content

AttributeError: 'builtin_function_or_method' object has no attribute '__python_implementation__' #142256

@weifengpy

Description

@weifengpy

🐛 Describe the bug

FakeTensorMode throw runtime error in latest build 7281e0b
TorchTitan use FakeTensorMode to estimate memory usage and that's why I found this

repro

from torch._subclasses.fake_tensor import FakeTensorMode
with FakeTensorMode():
    pass
Traceback (most recent call last):
  File "/data/users/weif/torchtitan/test_fake_tensor_mode.py", line 3, in <module>
    with FakeTensorMode():
  File "/data/users/weif/pytorch/torch/_subclasses/fake_tensor.py", line 1150, in __init__
    import torch._dynamo.config
  File "/data/users/weif/pytorch/torch/_dynamo/__init__.py", line 42, in <module>
    from .polyfills import loader as _  # usort: skip # noqa: F401
  File "/data/users/weif/pytorch/torch/_dynamo/polyfills/loader.py", line 24, in <module>
    POLYFILLED_MODULES: Tuple["ModuleType", ...] = tuple(
  File "/data/users/weif/pytorch/torch/_dynamo/polyfills/loader.py", line 25, in <genexpr>
    importlib.import_module(f".{submodule}", package=polyfills.__name__)
  File "/home/weif/.conda/envs/pytorch-3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/data/users/weif/pytorch/torch/_dynamo/polyfills/pytree.py", line 52, in <module>
    __func.__python_implementation__
AttributeError: 'builtin_function_or_method' object has no attribute '__python_implementation__'

Versions

7281e0b

cc @chauhang @penguinwu

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions