harvardnlp / pytorch-struct

Fast, general, and tested differentiable structured prediction in PyTorch
http://harvardnlp.github.io/pytorch-struct
MIT License
1.11k stars 93 forks source link

add initial pass at arg_constraints and arg validation. #123

Closed erip closed 2 years ago

erip commented 2 years ago

Fixes #120.

erip commented 2 years ago

I'm a bit sketchy on constraints for some of the parameters which get overloaded as tuples (i.e., log_potentials in SentCFG), so review on this seems particularly relevant. Everything else is pretty vanilla.

srush commented 2 years ago

SentCFG is a tuple of reals (triple). Does that work with constraints?

erip commented 2 years ago

I guess that's the question. It seems like typically the expectation is parameters are not composite so you can have a clean mapping of parameter -> constraint. Since log_potentials is still technically "a real" (just in higher dim space) it should be ok... I can look into adding a test to see if we can validate.

erip commented 2 years ago

As an aside, is there a reason CI didn't run on this PR? The GH Actions config looks OK so I'm not sure why I can't see the results of the tests.

srush commented 2 years ago

Kicked off the CI.