Fine-tune a Hugging Face model (GPU)
hf_train_gpu · Built-in action recipeFine-tune a Hugging Face transformers model for NER or text classification on your annotations on a GPU worker, for models too large to train on CPU.
If you've connected Ellf to your coding assistant, it can set up the action for you: it knows the recipe's settings, can create the datasets and assets it needs and will ask you about anything it can't work out itself.
✳︎Claude Code: Setting up an action
› Set up an Ellf action using the Fine-tune a Hugging Face model (GPU) recipe (hf_train_gpu) and help me choose the right settings for my data.- In the app, go to ActionsNew action.
- Select the Fine-tune a Hugging Face model (GPU) recipe under Training.
- Fill in the form – you'll need to provide Training data and Output settings. Everything else has sensible defaults.
- Create the action. It starts on your cluster straight away.
Create the action with ellf actions create and the recipe name. All settings from the form are available as arguments. To view all recipe arguments, run ellf actions create hf_train_gpu --help.
| Argument | Type | Description | Default |
|---|---|---|---|
--name | str | Name of the action | None |
--ner.train | List[str] | Training datasets (Datasets)One option for Training data | None |
--ner.train-asset | List[str] | Training datasets (Assets)One option for Training data | None |
--ner.eval | List[str] | Evaluation datasets (Datasets): If no datasets are provided, a portion of the training data (set by the Evaluation split) is held back for evaluation.One option for Training data | None |
--ner.eval-asset | List[str] | Evaluation datasets (Assets): If no datasets are provided, a portion of the training data (set by the Evaluation split) is held back for evaluation.One option for Training data | None |
--textcat.train | List[str] | Training datasets (Datasets)One option for Training data | None |
--textcat.train-asset | List[str] | Training datasets (Assets)One option for Training data | None |
--textcat.eval | List[str] | Evaluation datasets (Datasets): If no datasets are provided, a portion of the training data (set by the Evaluation split) is held back for evaluation.One option for Training data | None |
--textcat.eval-asset | List[str] | Evaluation datasets (Assets): If no datasets are provided, a portion of the training data (set by the Evaluation split) is held back for evaluation.One option for Training data | None |
--textcat-multilabel.train | List[str] | Training datasets (Datasets)One option for Training data | None |
--textcat-multilabel.train-asset | List[str] | Training datasets (Assets)One option for Training data | None |
--textcat-multilabel.eval | List[str] | Evaluation datasets (Datasets): If no datasets are provided, a portion of the training data (set by the Evaluation split) is held back for evaluation.One option for Training data | None |
--textcat-multilabel.eval-asset | List[str] | Evaluation datasets (Assets): If no datasets are provided, a portion of the training data (set by the Evaluation split) is held back for evaluation.One option for Training data | None |
--base-model-hf-hub.repo-id | str | Hugging Face model name: Model ID on huggingface.co, e.g. dslim/bert-base-NER. | None |
--base-model-hf-hub.revision | str | Hugging Face model revision: Branch, tag or commit to use. Pin a commit so a restart can't change behavior. | "main" |
--base-model-hf-model | str | Hugging Face model on your cluster: A Hugging Face checkpoint on your cluster, downloaded from the Hub or fine-tuned on your annotations. | None |
--output.skip | bool | Skip saving outputs: If checked, no Model or Results asset will be registered. | False |
--output.name | str | Output model name: Name of the Hugging Face model asset. The Results asset is registered under <name>.results. | "" |
--output.path | str | Model path: Where to save the model. Leave empty to use {__data__}/hf_models/<name> on the cluster's shared storage. | "" |
--output.version | str | Version: Semantic version applied to both the Model and Results assets. | "0.1.0" |
--hf-token | str | Hugging Face token: Your own HF token, stored as an Ellf secret. Only needed for gated or private base models. | None |
--lang | str | Language: spaCy language used to align annotations.Available: af, am, ar, az, bg, bn, bo, ca, cs, da, de, dsb, el, en, es, et, eu, fa, fi, fo, fr, ga, gd, grc, gu, he, hi, hr, hsb, ht, hu, hy, id, is, it, ja, kmr, kn, ko, ky, la, lb, lg, lij, lt, lv, mk, ml, mr, ms, nb, ne, nl, nn, pl, pt, ro, ru, sa, si, sk, sl, sq, sr, sv, ta, te, th, ti, tl, tn, tr, tt, uk, ur, vi, xx, yo, zh | "en" |
--exclude-annotators | List[str] | Exclude annotators: Agent or user IDs (see ellf agents list), or whole session names, whose answers are left out, e.g. an LLM agent's raw answers, so only human-corrected labels are trained on. | None |
--eval-split | float | Evaluation split: Portion of examples to hold back for evaluation if no dedicated evaluation datasets are provided. | 0.2 |
--epochs | int | Epochs | 3 |
--learning-rate | float | Learning rate | 0.00005 |
--batch-size | int | Batch size | 16 |
--max-length | int | Max sequence length (subword tokens): Longer texts are truncated. | 256 |
--seed | int | Random seed | 0 |
--config-overrides | List[str] | Training argument overrides: key=value pairs of transformers.TrainingArguments fields, e.g. weight_decay=0.01. | None |
--project-id | str | Project ID to add action to. Defaults to your saved project. | None |
--worker-class | str | Worker class to launch the action on, as configured on your cluster | None |