john-hewitt / structural-probes

Codebase for testing whether hidden states of neural networks encode discrete structures.
Other
381 stars 77 forks source link

add fixes for torch-1.0.0, new h5py #5

Closed john-hewitt closed 5 years ago

john-hewitt commented 5 years ago

deprecation warning/error fixes for new dependency versions

Looks like in the torch-1.0.x, the labels tensor is in CUDA mem by the time it hits reporter.py, leading to problems when scipy forces a conversion of the tensor to numpy. Brought to light in #4; this PR should fix that issue.

Further, now h5py preferred syntax for accessing data values doesn't use .value; using this was emitting a warning for each observation.

Finally, a sum call that should have been a torch.sum call was requiring a further wrapping in torch.tensor, which is a mess and was spitting errors; this has been fixes.