Skip to content

AI Fine-tuning

Fine-tune models and train LoRAs or styles from Drupal content through pluggable AI fine-tuning providers.

A fine-tuning job is a content entity (ai_finetuner) that records where the training material comes from, which provider plugin trains it and with which settings, and what the provider reports back. The module builds the dataset, submits it, polls the provider on cron and stores the resulting model or style id on the job.

Key features

  • Three dataset sources: images uploaded on the job, entities rendered through a view mode, or a View with an "AI fine-tuning dataset" display.
  • Two dataset types: image for LoRA and style training, text for records with a title and a body that can be exported as JSONL for language model fine-tuning.
  • A #[AiFinetune] plugin type, so any provider module can add training support without changes to this module.
  • An admin UI at /admin/config/ai/finetune to add, start, refresh and cancel jobs.
  • Drush commands for the whole lifecycle, including --wait polling.
  • Cron polling of every active job.

How it fits together

flowchart LR
    subgraph Dataset sources
        U[Uploaded images]
        E[Entities rendered<br>through a view mode]
        V[View with an<br>AI fine-tuning dataset display]
    end
    U --> R[FinetuneRunner]
    E --> R
    V --> R
    R -- FinetuneDataset --> P[AiFinetune plugin]
    P -- start / status / cancel --> API[Provider API]
    API -- FinetuneStatus --> J[(Fine-tuning job entity)]
    C[Cron] -. refresh active jobs .-> R

The module owns the workflow: dataset building, the job entity, the UI, Drush commands and cron polling. A plugin only talks to one provider: upload the dataset, start a training, report the status, cancel.

Where to go next