Skip to content

init_meta_context fails isinstance call (fails xFormers) #10323

@SeanNaren

Description

@SeanNaren

🐛 Bug

The below case fails for init_meta_context. This probably has to do something with the subclasses for MyModule being changed. This as a result fails when we use an xformers model factory within the context manager.

import torch

from pytorch_lightning.utilities.meta import init_meta_context


class BaseModule(torch.nn.Module):
    pass


class MyModule(BaseModule):
    pass


with init_meta_context():
    my_module = MyModule()
    assert isinstance(my_module, BaseModule)

cc @tchaton @blefaudeux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedOpen to be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions