Train transfomer-based models
Project description
Zelda Rose
A trainer for transformer-based models.
Installation
Simply install with pip (preferably in a virtual env, you know the drill)
pip install zeldarose
Train a model
Here is a short example:
TOKENIZERS_PARALLELISM=true zeldarose-tokenizer --vocab-size 4096 --out-path local/tokenizer --model-name "my-muppet" tests/fixtures/raw.txt
zeldarose-transformer --tokenizer local/tokenizer --pretrained-model flaubert/flaubert_small_cased --out-dir local/muppet --val-text tests/fixtures/raw.txt tests/fixtures/raw.txt
There are other parameters (see zeldarose-transformer --help
for a comprehensive list), the one you are probably mostly interested in is --config
(for which there is an example target in examples/
).
The parameters --pretrained-models
, --tokenizer
and --model-config
are all fed directly to Huggingface's transformers
and can be pretrained models names or local path.
Distributed training
This is somewhat tricky, you have several options
-
If you are running in a SLURM cluster use
--accelerator ddp
and invoke viasrun
-
Otherwise you have two options
- Run with
--accelerator ddp_spawn
, which usesmultiprocessing.spawn
to start the process swarm (tested, but possibly slower and more limited, seepytorch-lightning
doc) - Run with
--accelerator ddp
and start withtorch.distributed.launch
with--use_env
and--no_python
(untested)
- Run with
Other hints
- Data management relies on 🤗 datasets and use their cache management system. To run in a clear
environment, you might have to check the cache directory pointed to by the
HF_DATASETS_CACHE
environment variable.
Inspirations
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
Hashes for zeldarose-0.3.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fd3ee89b1c454c6f242a1f758fad521f2083fc9717a1f9e68b9d4b46f5acb99 |
|
MD5 | 8ecb8e9f0f88fc7d5dd6da301c1977ff |
|
BLAKE2b-256 | 1045684b972a8789e3f761be72f65ae7f219533a1ff0b79f35b94232a6f0c424 |