Skip to main content

tfs-mt
Transformer from scratch for Machine Translation

Release Build status License: MIT License: CC BY-SA 4.0 pypi monthly downloads

▶️ Getting started • 📖 Documentation • 🤗 Hugging Face • 🎬 Demo


This project implements the Transformer architecture from scratch considering Machine Translation as the usecase. It's mainly intended as an educational resource and a functional implementation of the architecture and the training/inference logic.

Getting Started

From PyPI

pip install tfs-mt

From source

Prerequisites

Steps

git clone https://github.com/Giovo17/tfs-mt.git
cd tfs-mt

uv sync

cp .env.example .env
# Edit .env file with your configuration

Usage

Training

To start training the model with the default configuration:

uv run src/train.py

Inference

To run inference using the trained model from the HuggingFace repo:

uv run src/inference.py

Configuration

The whole project parameters can be configured in src/tfs_mt/configs/config.yml. Key configurations include:

  • Model Architecture: Config, dropout, GloVe embedding init, ...
  • Training: Optimizer, Learning rate scheduler, number of epochs, ...
  • Data: Dataset, Dataloader, Tokenizer, ...

Documentation

Full documentation is available at https://giovo17.github.io/tfs-mt/.

The technical breakdown of the architecture and the training/inference workflows can be found in the following documentation sections:

Model Sizes

The project supports various model configurations to suit different computational resources:

Parameter Nano Small Base Original
Encoder Layers 4 6 8 6
Decoder Layers 4 6 8 6
d_model 50 100 300 512
Num Heads 4 6 8 8
d_ff 200 400 800 2048
Norm Type PostNorm PostNorm PostNorm PostNorm
Dropout 0.1 0.1 0.1 0.1
GloVe Dim 50d 100d 300d -

License

  • Source code: licensed under the MIT License.

    • Note: This project includes modified code derived from PyTorch Ignite, which is licensed under the BSD 3-Clause License. See the LICENSE file for the full text of both licenses and original copyright notices.
  • Documentation: located in the docs/ directory, licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). See docs/LICENSE.

Citation

If you use tfs-mt in your research or project, please cite:

@software{Spadaro_tfs-mt,
author = {Spadaro, Giovanni},
licenses = {MIT, CC BY-SA 4.0},
title = {{tfs-mt}},
url = {https://github.com/Giovo17/tfs-mt}
}

Metadata

Release files for tfs-mt 0.1.4.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tfs-mt 0.1.4.post1
File Size Uploaded Provenance Actions
tfs_mt-0.1.4.post1.tar.gz 173.4 kB Without provenance Details for tfs_mt-0.1.4.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tfs-mt 0.1.4.post1
File Interpreter ABI Platform Actions
tfs_mt-0.1.4.post1-py3-none-any.whl Python 3 none any Details for tfs_mt-0.1.4.post1-py3-none-any.whl

Total release size: 226.0 kB

Release files / tfs_mt-0.1.4.post1.tar.gz

Download URL tfs_mt-0.1.4.post1.tar.gz
Size 173.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b21cc5cf372da98818b1a3a5638a213ad570e8de4f7832785e09b4da9de4d503
BLAKE2b-256 checksum
How to use checksums
8901d2bd33d10ad116ef2d636b739a573e19c170bed1c86d58d65fe79437bb22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tfs_mt-0.1.4.post1-py3-none-any.whl

Download URL tfs_mt-0.1.4.post1-py3-none-any.whl
Size 52.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
667b22a66229fa6e277f4e9e64b05ac71e756a4dd2a79c03a5202d733db4cdd7
BLAKE2b-256 checksum
How to use checksums
f72b0e5b5dc23aeac0a3d215a3ec0f180c5e7b7bb941848c82e62b299e10efc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for tfs-mt 0.1.4.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page