Skip to content

Runtime error when importing model #3298

@mitchell-reid

Description

@mitchell-reid

I am trying to import a model for use with torcheia. I am using the following code:

import torch

def model_fn():
    model = torch.jit.load("cos_1.5.1.pt", map_location=torch.device('cpu'))
    if torch.__version__ == '1.5.1':
        import torcheia
        model = model.eval()
        model = torcheia.jit.attach_eia(model, 0)
    
    return model

model = model_fn()

This is resulting in the following error: RuntimeError: class '__torch__.torch.nn.modules.conv.___torch_mangle_1.Conv2d' already defined.
Full traceback as follows:

Traceback (most recent call last):
  File "main.py", line 50, in <module>
    model = model_fn()
  File "main.py", line 15, in model_fn
    model = torcheia.jit.attach_eia(model, 0)
  File "/home/ubuntu/.pyenv/versions/eia-testing/lib/python3.6/site-packages/torcheia/jit/__init__.py", line 5, in attach_eia
    newobj = _torch_eia._tag_eia_device(obj._c, device)
RuntimeError: class '__torch__.torch.nn.modules.conv.___torch_mangle_1.Conv2d' already defined.

Since the error is occuring within the compiled files I have no way of investigating further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions