span-parser
span-parser copied to clipboard
Can't load saved model
I'm having trouble loading the trained model that ships with the repo.
$ python src/main.py --test data/23.auto.clean --vocab data/vocab.json --model data/model
...
Loaded test trees from data/23.auto.clean
Traceback (most recent call last):
File "src/main.py", line 179, in <module>
network = Network.load(args.model)
File "span-parser-master/src/network.py", line 384, in load
network.model.load(filename)
AttributeError: '_dynet.ParameterCollection' object has no attribute 'load'
According to this issue, dynet has dropped the Model class in favor of ParameterCollection. This matches the documentation on loading and saving models.
I tried patching it myself, but I'm not sure if data/model might need to be regenerated or something like that...
With the dynet version 2.0 . You can use "network.model.populate(filename)" to substitute "network.model.load(filename)". And the hyper parameters ("word_count, tag_count" etc) need to be stored separately.