While this won’t go through as particularly enlightened PyTorch code (if only because CNNCharEncoding has a useless LSTM submodule the way it is constructed) and the return values from forward seem incompatible, it would appear that the author of the code foresees to use one or the other, using either an LSTM or CNN layer to contextualize embeddings. A while ago using CNNs instead of LSTMs on sequences was all the rage, that died down a bit with transformers, although one might also see this as a sort of evolution.
Best regards
Thomas



 Elidor:

P.s. The question is also about SO


I will say very candidly that I don’t think asking the same question twice is a good use of everyone’s time. Just because people answer for free does not mean it is a resource you can waste.