All examples
Language models

Train with an explicit CUDA profile

Select FP16 compute, fused NF4 and managed memory AdamW, retain exact checkpoint continuation and deploy FP32 master weights.

gen_accelerated_training.aner
// Requires the matching native CUDA training build and a supported Llama GGUF.
// Configure CUBLAS_WORKSPACE_CONFIG=:4096:8 before process startup.
// Supply disjoint question,answer CSVs. All output destinations must be new.
// Checking this program never loads weights, trains or downloads dependencies.
import aner.gen
import aner.llm

let packed = gen.import_nf4("models/base-f16.gguf", double_quant: true,
    max_memory_bytes: 4294967296, device: "cuda:0")
let selected = packed.qlora()
let model = selected.with_training_profile(precision: "float16",
    optimizer: "paged_adamw", nf4_kernel: "fused", page_bytes: 2097152)
// Floating full fine-tuning instead starts from gen.import_model(...,"cuda:0").
// LoRA-FA, rsLoRA and TinyLoRA can use the same explicit training profile.
print(model.training_profile())
print(model.memory_summary())

let training = gen.supervised_csv(model, "training.csv", input: "question",
    target: "answer", role: "training", context: 128)
let validation = gen.supervised_csv(model, "validation.csv", input: "question",
    target: "answer", role: "validation", context: 128)
let tuned = model.fine_tune(training, validation, steps: 2,
    micro_batch: 1, accumulation: 2, rate: 0.0002, seed: 71)
print(tuned.validation_loss())
print(tuned.training_profile())
tuned.checkpoint("checkpoint-accelerated-2")

let restored = gen.load_pretrained_checkpoint("checkpoint-accelerated-2",
    device: "cuda:0", max_memory_bytes: 4294967296)
let continued = restored.resume(training, validation, steps: 1)
// Exports merge the FP32 master state into standard deployment weights.
continued.save_model("accelerated-f32.gguf")
let deployed = llm.load("accelerated-f32.gguf", context: 128, device: "cpu")
print(deployed.generate("Explain the purpose of held-out data.",
    max_tokens: 32, temperature: 0.0, seed: 0).text())
deployed.close()

Make it your experiment.

Use the matching development runtime. Save this program as examples/gen_accelerated_training.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/gen_accelerated_training.aner
aner run examples/gen_accelerated_training.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires the matching optional native CUDA/LibTorch development runtime with FP16, fused NF4 and managed memory paged AdamW. Supply models/base-f16.gguf as a supported floating dense Llama GGUF and disjoint training.csv/validation.csv files with question,answer columns. Set CUBLAS_WORKSPACE_CONFIG=:4096:8 before process startup and use fresh output destinations. Published Aner 0.0.5 packages do not supply these APIs. Checking opens no model or connection; running performs local training without downloading dependencies or calling a provider.

Credential setup
aner check examples/gen_accelerated_training.aner
aner run examples/gen_accelerated_training.aner

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner