local handle = alc.nn.preset.gpt2("tiny", { pretrained = false, device = "cpu" })
assert(handle:variant() == "tiny", "expected tiny variant, got " .. tostring(handle:variant()))
assert(handle:layers() == 2, "tiny variant must have 2 layers")
assert(handle:vocab() == 64, "tiny variant must have vocab=64")
local rows = {
{ 1, 5, 12, 20, 33, 44, 51, 60 },
{ 2, 8, 15, 22, 30, 40, 55, 63 },
{ 3, 9, 17, 25, 32, 42, 50, 58 },
{ 4, 10, 18, 26, 34, 45, 52, 59 },
}
local ds = alc.nn.data.synthetic(rows, {
batch_size = 1,
ctx_len = 8,
shuffle = false,
pad_id = 0,
})
local ckpt = alc.nn.trainer.full_ft(handle, ds, {
lr = 3e-4,
batch_size = 1,
steps = 3,
warmup = 0,
schedule = "cosine",
weight_decay = 0.0,
ckpt_every = 0,
card_id = "smoke_full_ft",
})
assert(type(ckpt) == "table", "ckpt must be a table")
assert(ckpt.step == 3, "expected 3 steps completed, got " .. tostring(ckpt.step))
assert(type(ckpt.train_loss) == "number", "train_loss must be number")
assert(type(ckpt.bundle_ref) == "string", "bundle_ref must be string")
assert(type(ckpt.metrics) == "table", "metrics must be table")
assert(ckpt.lora == nil, "full_ft ckpt must NOT carry a lora sub-table")
return {
ok = true,
variant = "full_ft",
step = ckpt.step,
train_loss = ckpt.train_loss,
bundle_ref = ckpt.bundle_ref,
}