There are two minor fixes in the PyTorch-CRF code that this PR resolves:
1) The best path for a model was not saving the absolute path the first time and hence, the model loading was throwing issues when invoked from a directory that was different from when training was called.
2) The tempfile function I was using returned the same temp directory each time and this would cause the code to save the same model across different entity recognition models.
UPDATE:
This PR has now evolved into changing the way we now dump and load PyTorch CRF models. We no longer dump the entire class object to the entity pickle, but rather save only the config and encoder details, thus following a approach more in line with the LSTM model.
There are two minor fixes in the PyTorch-CRF code that this PR resolves: 1) The best path for a model was not saving the absolute path the first time and hence, the model loading was throwing issues when invoked from a directory that was different from when training was called. 2) The tempfile function I was using returned the same temp directory each time and this would cause the code to save the same model across different entity recognition models.
UPDATE: This PR has now evolved into changing the way we now dump and load PyTorch CRF models. We no longer dump the entire class object to the entity pickle, but rather save only the config and encoder details, thus following a approach more in line with the LSTM model.