Overview of AutoTrain Advanced capabilities
mainAutoTrain Advanced is a no-code platform for training state-of-the-art models across multiple domains, including:
- Natural Language Processing (NLP)
- Computer Vision (CV)
- Speech
- Tabular Data analysis
repository·main·Indexed 26 days ago
https://github.com/huggingface/autotrain-advancedA no-code solution for training and deploying state-of-the-art machine learning models. Supports LLM finetuning (SFT, DPO, ORPO), text classification, regression, Seq2Seq, token classification, and image tasks. Features include a web UI, a CLI for YAML-based configurations, and a programmatic API for project creation. Compatible with local environments and Google Colab.
AutoTrain Advanced is a no-code platform for training state-of-the-art models across multiple domains, including:
AutoTrain supports five distinct fine-tuning modes for Sentence Transformers. Choose the mode that matches your dataset structure:
pair: Training with two sentences (anchor and positive).pair_class: Training with two sentences (premise and hypothesis) and a target label.pair_score: Training with two sentences (sentence1 and sentence2) and a target score.triplet: Training with three sentences (anchor, positive, and negative).qa: Training with two sentences (query and answer).To perform local training, create a config.yaml file specifying the task, base_model, backend: local, and your data/parameter configurations.
Example Image Classification Config:
task: image_classification
base_model: google/vit-base-patch16-224
project_name: autotrain-cats-vs-dogs-finetuned
log: tensorboard
backend: local
data:
path: cats_vs_dogs
train_split: train
valid_split: null
column_mapping:
image_column: image
target_column: label
params:
epochs: 2
batch_size: 4
lr: 2e-5
optimizer: adamw_torch
scheduler: linear
gradient_accumulation: 1
mixed_precision: fp16
hub:
username: ${HF_USERNAME}
token: ${HF_TOKEN}
push_to_hub: trueExample Image Regression Config:
task: image_regression
base_model: microsoft/resnet-50
project_name: autotrain-img-quality-resnet50
log: tensorboard
backend: local
data:
path: abhishek/img-quality-full
train_split: train
valid_split: null
column_mapping:
image_column: image
target_column: target
params:
epochs: 10
batch_size: 8
lr: 2e-3
optimizer: adamw_torch
scheduler: cosine
gradient_accumulation: 1
mixed_precision: fp16
hub:
username: ${HF_USERNAME}
token: ${HF_TOKEN}
push_to_hub: trueRun the training using the CLI:
autotrain --config config.yamlautotrain --config config.yamlInstall AutoTrain Advanced using pip. It is highly recommended to use a virtual environment (like Conda) to prevent dependency conflicts.
Important Note: AutoTrain does not install large dependencies like pytorch, torchaudio, or torchvision automatically. You must install these separately. For optimal performance, you may also want to install flash-attn, deepspeed, and xformers.
$ 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 deepspeedTo view the documentation in a browser, use the doc-builder preview command. The documentation will be served at http://localhost:5173.
Important Notes:
preview command only works with existing doc files._toctree.yml and restart the preview command (stop it with ctrl-c and run it again).doc-builder preview autotrain docs/source/block_size and model_max_length based on available hardware.To perform LLM finetuning locally, create a config.yaml file containing your training parameters and run the autotrain command.
Key configuration sections include:
task: The training task (e.g., llm-orpo).base_model: The model identifier from Hugging Face.data: Specifies the path (Hugging Face dataset or local directory), train_split, chat_template, and column_mapping (mapping dataset columns to text_column, rejected_text_column, and prompt_text_column).params: Training hyperparameters like epochs, batch_size, lr, peft, quantization, and target_modules.hub: Configuration for pushing the model to the Hugging Face Hub, including username, token, and push_to_hub.task: llm-orpo
base_model: meta-llama/Meta-Llama-3-8B-Instruct
project_name: autotrain-llama3-8b-orpo
log: tensorboard
backend: local
data:
path: argilla/distilabel-capybara-dpo-7k-binarized
train_split: train
valid_split: null
chat_template: chatml
column_mapping:
text_column: chosen
rejected_text_column: rejected
prompt_text_column: prompt
params:
block_size: 1024
model_max_length: 8192
max_prompt_length: 512
epochs: 3
batch_size: 2
lr: 3e-5
peft: true
quantization: int4
target_modules: all-linear
padding: right
optimizer: adamw_torch
scheduler: linear
gradient_accumulation: 4
mixed_precision: fp16
hub:
username: ${HF_USERNAME}
token: ${HF_TOKEN}
push_to_hub: true$ autotrain --config config.yamlSeq2Seq tasks (such as machine translation, summarization, or question answering) require a dataset with exactly two columns: text and target. You can provide your data in either CSV or JSONL format.
CSV Format:
text,target
"this movie is great","dieser Film ist großartig"
"this movie is bad","dieser Film ist schlecht"JSONL Format:
{"text": "this movie is great", "target": "dieser Film ist großartig"}
{"text": "this movie is bad", "target": "dieser Film ist schlecht"}Install the AutoTrain Advanced library using pip to enable model training for various tasks like LLM finetuning, text classification, and image classification.
$ pip install autotrain-advancedTo use the AutoTrain API, install autotrain-advanced and start the application server using the autotrain app command. You can specify the host and port to control where the API is accessible. Once running, the interactive API documentation (Swagger/OpenAPI) is available at the specified host and port under the /docs path.
$ autotrain app --port 8000 --host 127.0.0.1