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.
Project description
LaMoTO
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.
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, 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)
See all the supported pre-training and fine-tuning tasks under lamoto.tasks.
Installation
If you don't want to edit the source code yourself, run
pip install "lamoto[github] @ git+https://github.com/bauwenst/LaMoTO"
and if you do, instead run
git clone https://github.com/bauwenst/LaMoTO
cd LaMoTO
pip install -e .[github]
If you are me from the future: don't include the [github] tag, it will fuck up the editable installs for the packages I maintain.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lamoto-2024.10.1.tar.gz.
File metadata
- Download URL: lamoto-2024.10.1.tar.gz
- Upload date:
- Size: 52.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afd0a578dba3793b614f0d15d636428d4858e09797e0d5149820a377e41e20cf
|
|
| MD5 |
4f735b6eff10dcf7245d74cbd29112d0
|
|
| BLAKE2b-256 |
4bad1faf5bc280dd2454bea6bbd21333a8826c83f001a81c0c5f050f45fe264d
|
File details
Details for the file lamoto-2024.10.1-py3-none-any.whl.
File metadata
- Download URL: lamoto-2024.10.1-py3-none-any.whl
- Upload date:
- Size: 64.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc4642eb5674cab8b76acd227b177e552767a848c92034173f052bad58d90a88
|
|
| MD5 |
34911abbca1312ab333560101c243fbf
|
|
| BLAKE2b-256 |
42ea9c0bff6d72487f01a4f3eee86d023b8944518c8986b72ae0b0c3647077be
|