Hi, I read the Pytorch RNN tutorial (NLP From Scratch: Generating Names with a Character-Level RNN — PyTorch Tutorials 2.6.0+cu124 documentation) where it generates names (output: multiple characters) given a language (one input). It is done by a loop until the output is a EOS token. Are there ways to do it as in a many-to-one RNN model without a loop? Thanks
Yes. Sort of. But then it’s no longer an RNN. It’s then called a Transformer. Please see this paper:
Transformers work just fine asynchronously during training. This is done via a triangular matrix masking the latter tokens in the sequence. But during inference time, you still need to iterate.
Please see the tutorials starting here at Huggingface(library built on PyTorch):