GT4SD's trainer submodule for HF transformers and PyTorch Lightning
Train Language Models via HuggingFace transformers and PyTorch Lightning.
Development setup & installation
Create any virtual or conda environment compatible with the specs in setup.cfg. Then run:
pip install -e ".[dev]"
Perform training via the CLI command
GT4SD provides a trainer client based on the gt4sd-lm-trainer CLI command.
$ gt4sd-trainer-lm --help
usage: gt4sd-trainer-lm [-h] [--configuration_file CONFIGURATION_FILE]
optional arguments:
-h, --help show this help message and exit
--configuration_file CONFIGURATION_FILE
Configuration file for the trainining. It can be used
to completely by-pass pipeline specific arguments.
(default: None)
To launch a training you have two options.
You can either specify the path of a configuration file that contains the needed training parameters:
gt4sd-trainer-lm --training_pipeline_name ${TRAINING_PIPELINE_NAME} --configuration_file ${CONFIGURATION_FILE}
Or you can provide directly the needed parameters as arguments:
gt4sd-trainer-lm --type mlm --model_name_or_path mlm --training_file /path/to/train_file.jsonl --validation_file /path/to/valid_file.jsonl
Convert PyTorch Lightning checkpoints to HuggingFace model via the CLI command
Once a training pipeline has been run via the gt4sd-lm-trainer, it's possible to convert the PyTorch Lightning checkpoint
to HugginFace model via gt4sd-pl-to-hf:
gt4sd-pl-to-hf --hf_model_path ${HF_MODEL_PATH} --training_type ${TRAINING_TYPE} --model_name_or_path ${MODEL_NAME_OR_PATH} --ckpt {CKPT} --tokenizer_name_or_path {TOKENIZER_NAME_OR_PATH}
References
If you use gt4sd in your projects, please consider citing the following:
@article{manica2022gt4sd,
title={GT4SD: Generative Toolkit for Scientific Discovery},
author={Manica, Matteo and Cadow, Joris and Christofidellis, Dimitrios and Dave, Ashish and Born, Jannis and Clarke, Dean and Teukam, Yves Gaetan Nana and Hoffman, Samuel C and Buchan, Matthew and Chenthamarakshan, Vijil and others},
journal={arXiv preprint arXiv:2207.03928},
year={2022}
}
License
The gt4sd codebase is under MIT license.
For individual model usage, please refer to the model licenses found in the original packages.
Metadata
Release files for gt4sd-trainer-hf-pl 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gt4sd-trainer-hf-pl-1.0.0.tar.gz | 17.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gt4sd_trainer_hf_pl-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.0 kB
Release files / gt4sd-trainer-hf-pl-1.0.0.tar.gz
| Download URL | gt4sd-trainer-hf-pl-1.0.0.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fc457e7296e3824ca8e3dd1be857cde8a0f51e890d13170774f2483b230e21a
|
|
BLAKE2b-256 checksum How to use checksums |
86f7bbf031516c47b5709ae40343bcab0c532044315cfed593ec67f868e21d2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / gt4sd_trainer_hf_pl-1.0.0-py3-none-any.whl
| Download URL | gt4sd_trainer_hf_pl-1.0.0-py3-none-any.whl |
|---|---|
| Size | 27.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95fe13e951eb4e3009262b041437bbb92fbe9c5f34d99c1c95367fb1e1a6cf16
|
|
BLAKE2b-256 checksum How to use checksums |
9c76460270a33c451846f0542e99b5dd06fae6af3a07b3a4771c9246196abd40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for gt4sd-trainer-hf-pl 1.0.0
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.