Summary:
Adds support for pickling instances of LexiconFreeDecoderOptions and LexiconFreeDecoder which is needed for pyper training/integration.
Lexicon-free decoding is the only decoding type currently supported for serialization; it's also the only type for which serialization of any kind makes sense given that decoding state is implemented with opaque pointer types, and reproducing it is expensive and requires breaking a lot of abstraction. Serializing a Lexicon/Trie is also difficult due to how they're efficiently constructed in memory, so it is likely more efficient to simply serialize an uncompressed token set, then deserialize when using a decoder.
Since there's no way to reliably serialize LMs, only LexiconFreeDecoders with ZeroLMs can be serialized.
Summary: Adds support for pickling instances of
LexiconFreeDecoderOptions
andLexiconFreeDecoder
which is needed for pyper training/integration.Lexicon-free decoding is the only decoding type currently supported for serialization; it's also the only type for which serialization of any kind makes sense given that decoding state is implemented with opaque pointer types, and reproducing it is expensive and requires breaking a lot of abstraction. Serializing a Lexicon/Trie is also difficult due to how they're efficiently constructed in memory, so it is likely more efficient to simply serialize an uncompressed token set, then deserialize when using a decoder.
Since there's no way to reliably serialize LMs, only
LexiconFreeDecoder
s withZeroLM
s can be serialized.Reviewed By: redraven984
Differential Revision: D40951537