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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to trace IntraNoAR model #14

Open
bhushan23 opened this issue Mar 30, 2023 · 0 comments · May be fixed by #15
Open

Unable to trace IntraNoAR model #14

bhushan23 opened this issue Mar 30, 2023 · 0 comments · May be fixed by #15

Comments

@bhushan23
Copy link

bhushan23 commented Mar 30, 2023

Repro script

model = IntraNoAR()
model_path = '<path to DCVC repo>/DCVC-DC/checkpoints/cvpr2023_image_psnr.pth.tar'
state_dict = get_state_dict(model_path)
model.load_state_dict(state_dict)
model.eval()

input_shape = (1, 3, 1088, 1920)
x = torch.ones(input_shape)
traced_model = torch.jit.trace(model, x)
  File "<path to lib>/lib/python3.9/site-packages/torch/jit/_trace.py", line 759, in trace
    return trace_module(
  File "<path to lib>/python3.9/site-packages/torch/jit/_trace.py", line 976, in trace_module
    module._c._create_method_from_trace(
  File "<path to lib>/python3.9/site-packages/torch/nn/modules/module.py", line 1178, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "<path to dcvc>/DCVC-DC/src/models/image_model.py", line 115, in forward
    curr_q_enc, curr_q_dec = self.get_q_for_inference(q_in_ckpt, q_index)
  File "<path to dcvc>/DCVC-DC/src/models/image_model.py", line 109, in get_q_for_inference
    curr_q_enc = self.get_curr_q(q_scale_enc, self.q_basic_enc, q_index=q_index)
  File "<path to dcvc>/DCVC-DC/src/models/common_model.py", line 37, in get_curr_q
    return q_basic * q_scale
  File "<path to lib>/lib/python3.9/site-packages/torch/_tensor.py", line 955, in __array__
    return self.numpy()
RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.
bhushan23 added a commit to bhushan23/DCVC that referenced this issue Mar 30, 2023
 - Update default value of q_index to 0 instead of None

resolves microsoft#14
@bhushan23 bhushan23 linked a pull request Mar 30, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant