PyTorch Transformers
Now you're familiar with the different components of the transformer architecture, it's time to define one! The torch.nn module, imported for you as nn, provides a really nice way to do this in just a few lines of code.
Diese Übung ist Teil des Kurses
<Kurs>Transformer Models with PyTorch</Kurs>Übungsanweisungen
- Define a transformer with
8attention heads,6encoder and decoder layers, and for input sequence embeddings of length1536. - Print the model object to view the model architecture.
Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Define the transformer model
model = ____
# Print the model object
print(____)