See the Official Documentation site
Current version: 1.2.1
A TensorFlow-compatible Python library that provides models and layers to implement custom Transformer neural networks.
Built on TensorFlow 2.
Logo generated by Stable Diffusion 2.1
Its installation is straightforward:
pip install maximal
maximal
is commonly called as:
import maximal as ml
from maximal.layers import TransformerLayer, GPTLayer
and can be used in a tf.keras
model as any common layer.
An Official Website is now available with documentation and tutorials.
PyPI link is available [here](https://pypi.org/project/maximal/1.0/.
In layers.py
:
-
SelfAttention
:keras.Layer
, computes Scaled Dot-Product Attention. -
MultiHeadSelfAttention
:keras.Layer
, it is a concatenation ofSelfAttention
layers, resized back to original input shape through linear transformation. -
PositionalEmbedding
:keras.Layer
, implements double Embedding layers used in Transformers literature, for tokens and positions. Positional encoding is learned through atf.keras.layers.Embedding()
layer, instead of deterministic positional encoding in the original paper. -
ImageEmbedding
:keras.Layer
, implements double Embedding layers used as inputs of Vision Transformers, for image patches and positions. -
TransformerLayer
:keras.Layer
single Transformer Encoder piece. It can be used inside anySequential()
model in Keras. -
GPTLayer
:keras.Layer
GPT block. Similar toTransformerLayer
but with causal Attention mechanism. It can be used inside anySequential()
model in Keras.
Coming soon: models.py
.
h5py
numpy
tensorflow >= 2.0
Ivan Bongiorni. LinkedIn
2020 Ivan Bongiorni
This repository is licensed under the MIT license. See LICENCE.txt for further details.