Quickstart Guide for Local Training
This quickstart is for local installation and usage. If you want to use AutoTrain on Hugging Face Spaces, please refer to the AutoTrain on Hugging Face Spaces section.
You can install AutoTrain Advanced using pip:
$ pip install autotrain-advanced
It is advised to install autotrain-advanced in a virtual environment to avoid any conflicts with other packages. Note: AutoTrain doesn’t install pytorch, torchaudio, torchvision, or any other large dependencies. You will need to install them separately.
$ conda create -n autotrain python=3.10
$ conda activate autotrain
$ pip install autotrain-advanced
$ conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
$ conda install -c "nvidia/label/cuda-12.1.0" cuda-nvcc
$ conda install xformers -c xformers
$ python -m nltk.downloader punkt
$ pip install flash-attn --no-build-isolation # if you want to use flash-attn
$ pip install deepspeed # if you want to use deepspeed
Running AutoTrain User Interface (UI)
To run the autotrain app locally, you can use the following command:
$ export HF_TOKEN=your_hugging_face_write_token
$ autotrain app --host 127.0.0.1 --port 8000
This will start the app on http://127.0.0.1:8000
.
Using AutoTrain Command Line Interface (CLI)
It is also possible to use the CLI:
$ export HF_TOKEN=your_hugging_face_write_token
$ autotrain --help
This will show the CLI commands that can be used:
usage: autotrain <command> [<args>]
positional arguments:
{
app,
llm,
setup,
dreambooth,
api,
text-classification,
text-regression,
image-classification,
tabular,
spacerunner,
seq2seq,
token-classification
}
commands
options:
-h, --help show this help message and exit
--version, -v Display AutoTrain version
--config CONFIG Optional configuration file
For more information about a command, run: `autotrain <command> --help`
It is advised to use only the autotrain --config CONFIG_FILE
command for training when using the CLI.
The autotrain commands that end users will be interested in are:
app
: Start the AutoTrain UIllm
: Train a language modeldreambooth
: Train a model using DreamBoothtext-classification
: Train a text classification modeltext-regression
: Train a text regression modelimage-classification
: Train an image classification modeltabular
: Train a tabular modelspacerunner
: Train any custom model using SpaceRunnerseq2seq
: Train a sequence-to-sequence modeltoken-classification
: Train a token classification model
Note: above commands are not required if you use preferred autotrain --config CONFIG_FILE
command to train the models.