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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

model.copy() is broken #29170

Closed
bwasti opened this issue Nov 5, 2019 · 7 comments
Closed

model.copy() is broken #29170

bwasti opened this issue Nov 5, 2019 · 7 comments
Assignees
Labels
high priority oncall: jit Add this issue/PR to JIT oncall triage queue triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@bwasti
Copy link
Contributor

bwasti commented Nov 5, 2019

馃悰 Bug

Calling a scripted model.copy() is broken. Throws an error here:

RuntimeError: class '__torch__.torch.nn.modules.module.___torch_mangle_5.Module' already defined. (register_type at caffe2/torch/csrc/jit/script/compilation_unit.h:167)

To Reproduce

Steps to reproduce the behavior:

  1. create a scripted model
  2. call model.copy()

Expected behavior

Expected a copy to be made.

  • PyTorch Version (e.g., 1.0): master
  • OS (e.g., Linux): linus
  • How you installed PyTorch (conda, pip, source): source
  • Build command you used (if compiling from source): setup.py
  • Python version: 3.7

cc @ezyang @gchanan @zou3519 @jerryzh168 @suo

@VitalyFedyunin VitalyFedyunin added high priority module: nn Related to torch.nn triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Nov 5, 2019
@vadimkantorov
Copy link
Contributor

Also it seems that the copy method is not documented: https://pytorch.org/docs/master/search.html?q=copy&check_keywords=yes&area=default seems to not show any method named copy()

@zou3519 zou3519 added oncall: jit Add this issue/PR to JIT oncall triage queue and removed module: nn Related to torch.nn triage review triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Nov 6, 2019
@zou3519
Copy link
Contributor

zou3519 commented Nov 6, 2019

I don't think model.copy() exists or is supposed to exist on nn modules. This issue seems to be JIT-specific so I am tossing it onto the JIT queue.

@suo suo added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Nov 6, 2019
@suo
Copy link
Member

suo commented Nov 6, 2019

Assigning to @ZolotukhinM as I believe he implemented copy() (feel free to bounce back to me if I'm wrong about that). Can you take a look?

@ZolotukhinM
Copy link

I think @jerryzh168 fixed that in #29269

@ZolotukhinM ZolotukhinM assigned jerryzh168 and unassigned ZolotukhinM Nov 6, 2019
@jerryzh168
Copy link
Contributor

@bwasti can you provide an example? I can't reproduce with random scripted models

@jerryzh168
Copy link
Contributor

@bwasti my PR is landed, could you verify if this is resolved?

@jerryzh168
Copy link
Contributor

I'll close for now, feel free to re-open if the problem persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority oncall: jit Add this issue/PR to JIT oncall triage queue triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

7 participants