Skip to content

DependencyCRF partition function broken #104

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

Closed
teffland opened this issue Sep 1, 2021 · 3 comments
Closed

DependencyCRF partition function broken #104

teffland opened this issue Sep 1, 2021 · 3 comments

Comments

@teffland
Copy link

teffland commented Sep 1, 2021

Getting the following in-place operation error when using the DependencyCRF:

B,N = 3,50
phi = torch.randn(B,N,N)
DependencyCRF(phi).partition
/usr/local/lib/python3.7/dist-packages/torch_struct/deptree.py in _check_potentials(self, arc_scores, lengths)
    121         arc_scores = semiring.convert(arc_scores)
    122         for b in range(batch):
--> 123             semiring.zero_(arc_scores[:, b, lengths[b] + 1 :, :])
    124             semiring.zero_(arc_scores[:, b, :, lengths[b] + 1 :])
    125 

/usr/local/lib/python3.7/dist-packages/torch_struct/semirings/semirings.py in zero_(xs)
    124     @staticmethod
    125     def zero_(xs):
--> 126         return xs.fill_(-1e5)
    127 
    128     @staticmethod

RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.
@srush
Copy link
Collaborator

srush commented Sep 3, 2021

Interesting. Can I ask which torch version you are using? This is not failing on my side.

@srush
Copy link
Collaborator

srush commented Sep 3, 2021

Oh nvm. I see that it is failing in the latest pytorch version. I will see what changed.

@srush
Copy link
Collaborator

srush commented Sep 12, 2021

Fix coming in #105

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

No branches or pull requests

2 participants