Skip to contents

Writes a run directory exactly as dragon_train() would, but instead of launching the trainer it zips everything a GPU machine needs: the data in chat format, the configuration, the trainer's Python code, and a notebook that runs it. Nothing is trained locally and Python is not needed.

Usage

dragon_bundle(
  dataset,
  model,
  lora = dragon_lora(),
  args = dragon_train_args(),
  name = NULL,
  run_dir = NULL,
  runs_dir = dragon_runs_dir(),
  n_samples = 10,
  revision = NULL,
  trust_remote_code = FALSE
)

Arguments

dataset

A mapped dragon_dataset (see dragon_map()).

model

A Hugging Face model id such as "HuggingFaceTB/SmolLM2-135M-Instruct", or a local model directory. See dragon_presets().

lora

LoRA settings from dragon_lora().

args

Training settings from dragon_train_args().

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.

Value

A dragon_run whose state is "bundled".

Details

Continue with dragon_remote() to open a provider and see the steps, and dragon_import() to bring the results back into this run directory.

Examples

if (FALSE) { # \dontrun{
run <- dragon_dataset(dragon_example_data()) |>
  dragon_map(prompt = "{subject}\n\n{body}", response = "reply") |>
  dragon_bundle("Qwen/Qwen2.5-0.5B-Instruct")
dragon_remote(run, "colab")
# ... train in the browser, download the results zip ...
dragon_import(run, "~/Downloads/dragonfarm-results-<run id>.zip")
dragon_generate(run, "My thermostat keeps dropping off Wi-Fi.")
} # }