Skip to main content

LaMoTO: Language Modelling Tasks as Objects

Language Modelling Tasks as Objects (LaMoTO) provides a framework for language model training (masked and causal, pretraining and finetuning) where the tasks, not just the models, are classes themselves. It abstracts over the HuggingFace transformers.Trainer with one goal: reduce the entire model training process to a single method call task.train(hyperparameters).

pip install lamoto[all]

Note: to be able to use the W&B integration, make sure you first run wandb login in a command-line terminal on the system you want to run on.

Usage

Let's say you want to train a RoBERTa-base model for dependency parsing (for which, by the way, there is no HuggingFace class). This is how you would do that in LaMoTO, supported by the magic of ArchIt:

from archit.instantiation.basemodels import RobertaBaseModel
from archit.instantiation.heads import DependencyParsingHeadConfig, BaseModelExtendedConfig
from lamoto.tasks import DP
from lamoto.training.auxiliary.hyperparameters import getDefaultHyperparameters

# Define task hyperparameters.
hp = getDefaultHyperparameters()
hp.model_config_or_checkpoint = "roberta-base"
hp.archit_basemodel_class = RobertaBaseModel
hp.archit_head_config = DependencyParsingHeadConfig(
    head_dropout=0.33,
    extended_model_config=BaseModelExtendedConfig(
        layer_pooling=1
    )
)

# Instantiate language modelling task as object, and train model.
task = DP()
task.train(hyperparameters=hp)

Features

  • Train models on >15 pre-training/fine-tuning tasks. See a list by importing from lamoto.tasks.
    • Model architectures come from ArchIt, which means that as long as you have a BaseModel wrapper for your language model backbone, you can train it on any task, regardless of whether you wrote code defining the backbone-with-head architecture required for that task.
    • Custom (i.e. given) architectures are also supported.
  • Evaluate models with a superset of the metrics in HuggingFace's evaluate, with custom inference procedures (see e.g. strided pseudo-perplexity or bits-per-character).
  • Augment datasets before training or evaluating by somehow perturbing them.
  • Supports TkTkT tokenisers.
  • W&B integration.

Alternative packages

There exist other libraries that abstract across training tasks in an effort to avoid heavily dedicated training scripts. I'm aware of the following packages (although I'm not sure how extensible they are):

Metadata

Release files for lamoto 2026.8.1

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

Source distribution (sdist)

Source distribution for lamoto 2026.8.1
File Size Uploaded
lamoto-2026.8.1.tar.gz 111.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lamoto 2026.8.1
File Interpreter ABI Platform
lamoto-2026.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 247.2 kB

Release files / lamoto-2026.8.1.tar.gz

Download URL lamoto-2026.8.1.tar.gz
Size 111.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a376ecd6679949a7e384a41c608384f8679b30daf7851402b5e728b9ee52bb8f
BLAKE2b-256 checksum
How to use checksums
1c6b2837cff9acf633af22f709d3a2abd7dedd4cb8d5af7eb1db539486e73b5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.13.14"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.13.14","system":{"name":"Linux","release":"6.17.0-1020-azure"}} HTTPX2/2.10.0

Release files / lamoto-2026.8.1-py3-none-any.whl

Download URL lamoto-2026.8.1-py3-none-any.whl
Size 135.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20c9c6bb9e3d76934a3d00cc159974ee07ce11d89aa52e5d4cc3b0a9d11ceda0
BLAKE2b-256 checksum
How to use checksums
4bf91d752c02012d57e8393ff694132f0f47a7cde7a8d896aa41ffe7f953f6d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.13.14"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.13.14","system":{"name":"Linux","release":"6.17.0-1020-azure"}} HTTPX2/2.10.0
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