Skip to main content

Reusable Transformer model components.

Project description

transformer_components_michaelkosmider

This package contains the source code for the Transformer implementation featured in my tutorial:
🔗 Transformer Tutorial

The full source code for this package is available here:
GitHub – transformer_components_michaelkosmider


Installation

This package requires PyTorch but does not install it automatically. You must install the correct version for your system (CPU/GPU, CUDA version, etc.) first:
PyTorch Installation Instructions

Once PyTorch is installed, install this package from PyPI.

Available Imports

This package exposes the following classes and functions at the top level:

  • TransformerDecoder
  • TransformerDecoderLayer
  • TransformerEncoder
  • TransformerEncoderLayer
  • TransformerEncoderDecoder
  • FeedForwardSubLayer
  • AttentionSubLayer
  • MultiHeadAttention
  • compute_attention_matrix
  • slice_vertically
  • unslice_vertically
  • get_causal_mask

Example:

from transformer_components_michaelkosmider import TransformerEncoder, get_causal_mask

encoder = TransformerEncoder(...)
mask = get_causal_mask(seq_len=10)

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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file transformer_components_michaelkosmider-0.1.1.tar.gz.

File metadata

File hashes

Hashes for transformer_components_michaelkosmider-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bbc7fa5faca719c1c29b9f2d84507b82674f8b96b08279ba4603ab85f1147367
MD5 43b1927fca4773bf382c7a3b56f76d85
BLAKE2b-256 a0c69644d051a09248ed9c335db748c8a59e20187766545352ee842e2aa153ff

See more details on using hashes here.

File details

Details for the file transformer_components_michaelkosmider-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for transformer_components_michaelkosmider-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0e88fa8ce363837b9656ca60ffeb4be54e6d48763f502dc74cef22948f12177b
MD5 81dcb03c90d25f162ace13176e1eb72f
BLAKE2b-256 47b23935257938862484b79379ad7e50aff8e4dc57824c6dd3e2f36712e30810

See more details on using hashes here.

Supported by

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