Transformers, Pytorch, Machine Learning, Deep Dives, Data Science.
self.transformer.decode(y, encoder_output) output = torch.argmax(probs, dim=-1) print(f"Knowing {y} we output {output[:, -1]}") if output[:, -1].detach().numpy() in (EOS_IDX, SOS_IDX): break outputs[:, step] = output[:, -1] return self.tokens_to_str(outputs[0]) translator = Translator(model) You