Writes a run directory, then launches the trainer as a background Python
process. Returns immediately unless wait = TRUE. The run survives the R
session; reopen it later with dragon_run().
Usage
dragon_train(
dataset,
model,
lora = dragon_lora(),
args = dragon_train_args(),
hardware = dragon_hardware(),
name = NULL,
run_dir = NULL,
runs_dir = dragon_runs_dir(),
n_samples = 10,
revision = NULL,
trust_remote_code = FALSE,
wait = FALSE
)Arguments
- dataset
A mapped
dragon_dataset(seedragon_map()).- model
A Hugging Face model id such as
"HuggingFaceTB/SmolLM2-135M-Instruct", or a local model directory. Seedragon_presets().- lora
LoRA settings from
dragon_lora().- args
Training settings from
dragon_train_args().- hardware
Hardware settings from
dragon_hardware().- name
Short label used in the run id. Defaults to the model name.
- run_dir
Exact directory to use. Defaults to a timestamped directory under
runs_dir.- runs_dir
Parent directory for runs. See
dragon_runs_dir().- n_samples
Number of held-out rows to generate sample replies for at the end of training.
- revision
Model revision (branch, tag, or commit) on the Hub.
- trust_remote_code
Allow the model repository to run custom code.
- wait
Block until training finishes.
Examples
if (FALSE) { # \dontrun{
run <- dragon_dataset(dragon_example_data()) |>
dragon_map(prompt = "{subject}\n\n{body}", response = "reply") |>
dragon_train("HuggingFaceTB/SmolLM2-135M-Instruct", wait = TRUE)
dragon_generate(run, "My order arrived damaged.")
} # }