Skip to main content

TensorFlow-compatible Transformer layers and models.

Project description

# maximal

See the [Official Documentation site](https://ivanbongiorni.github.io/maximal/)

Current version: 1.0

A TensorFlow-compatible Python library that provides models and layers to implement custom Transformer neural networks.

Built on TensorFlow 2.

# Installation Its installation is straightforward:

` pip install maximal `

# How to use it? maximal is commonly called as:

` import maximal from maximal.layers import TransformerLayer, GPTLayer `

and can be used in a tf.keras model as any common layer.

# Documentation An [Official Website](https://ivanbongiorni.github.io/maximal/) is now available with documentation and tutorials.

# Elements

In layers.py: - SelfAttention: keras.Layer, computes Scaled Dot-Product Attention.

  • MultiHeadSelfAttention: keras.Layer, it is a concatenation of SelfAttention 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 a tf.keras.layers.Embedding() layer, instead of deterministic positional encoding in the original paper.

  • TransformerLayer: keras.Layer single Transformer Encoder piece. It can be used inside any Sequential() model in Keras.

  • GPTLayer: keras.Layer GPT block. Similar to TransformerLayer but with causal Attention mechanism. It can be used inside any Sequential() model in Keras.

In schedules.py: - OriginalTransformerSchedule: keras.Layer implements the learning rate schedule of the original Transformer paper. It is taken from this [official TensorFlow tutorial](https://www.tensorflow.org/text/tutorials/transformer).

# Requirements ` numpy tensorflow >= 2.0 `

# Author Ivan Bongiorni. [LinkedIn](https://www.linkedin.com/in/ivan-bongiorni-b8a583164/)

# License 2020 Ivan Bongiorni

This repository is licensed under the MIT license. See [LICENCE.txt]() for further details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maximal-1.0.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file maximal-1.0.tar.gz.

File metadata

  • Download URL: maximal-1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for maximal-1.0.tar.gz
Algorithm Hash digest
SHA256 fc8b77a133a5700229989c18c2073acfed3b9da9c9ce05e591cdd94aa1da0e83
MD5 76e3ee0028eabc4e81d0d5ca854d09f7
BLAKE2b-256 948d21eefb0f74d9221816c0710a52d6875166289de67e28efcc08c3e03bb146

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page