huggingface / transfer-learning-conv-ai

🦄 State-of-the-Art Conversational AI with Transfer Learning
MIT License
1.74k stars 430 forks source link

Questions about interact.py #124

Open GlitchBox opened 1 year ago

GlitchBox commented 1 year ago

Hi, Can anyone explain why the code snippet (interact.py) (underlined in red) was necessary?

Screenshot from 2022-09-15 11-58-25

As far as I know the logits returned by OpenAIGPTLMHeadModel is of the following form : (batch_size, sequence_length, vocabulary size).

Why was only the last token in the output sequence considered as the predicted next token? Moreover, why do we have to iteratively generate an output text when the model itself returns a full sequence and not just a single token?