Trains a model with several output heads. Each head has its own labels,
loss type and weight; the optimized total is
sum(loss_weights[i] * loss_i).
ggml_opt_fit_multi(
sched,
ctx_compute,
inputs,
outputs,
dataset,
loss_types,
loss_weights = rep(1, length(outputs)),
labels_offs = NULL,
optimizer = ggml_opt_optimizer_type_adamw(),
nepoch = 1,
nbatch_logical = 32,
val_split = 0,
silent = FALSE
)Named list with train_loss, train_accuracy, val_loss, val_accuracy, head_loss (a nepoch x nhead matrix of unweighted per-head losses) and head_accuracy (same shape; NA for heads whose loss is not cross-entropy)
Backend scheduler
Compute context holding the model graph
Input tensor
List of output tensors, one per head
Dataset with data and concatenated labels
Integer vector of loss type constants, one per head
Numeric vector of head weights (default: all 1)
Numeric vector of label offsets, 0-based, one per head
Optimizer type constant
Number of epochs
Logical batch size
Fraction of the data used for validation
Suppress progress output
All heads share the dataset's datapoints. The dataset's labels hold every
head's labels concatenated along the first dimension: head i occupies
labels_offs[i] + seq_len(width_i) of each label row.
ggml_fit_opt_multi, which this wraps and which adds
callbacks and shuffling control
Other optimization:
ggml_fit_opt(),
ggml_fit_opt_multi(),
ggml_opt_alloc(),
ggml_opt_context_optimizer_type(),
ggml_opt_dataset_data(),
ggml_opt_dataset_free(),
ggml_opt_dataset_get_batch(),
ggml_opt_dataset_get_batch_head(),
ggml_opt_dataset_init(),
ggml_opt_dataset_labels(),
ggml_opt_dataset_ndata(),
ggml_opt_dataset_shuffle(),
ggml_opt_dataset_weights(),
ggml_opt_default_params(),
ggml_opt_epoch(),
ggml_opt_eval(),
ggml_opt_fit(),
ggml_opt_free(),
ggml_opt_get_lr(),
ggml_opt_grad_acc(),
ggml_opt_init(),
ggml_opt_init_for_fit(),
ggml_opt_init_for_fit_multi(),
ggml_opt_inputs(),
ggml_opt_labels(),
ggml_opt_loss(),
ggml_opt_loss_i(),
ggml_opt_loss_type_binary_cross_entropy(),
ggml_opt_loss_type_cross_entropy(),
ggml_opt_loss_type_huber(),
ggml_opt_loss_type_mae(),
ggml_opt_loss_type_mean(),
ggml_opt_loss_type_mse(),
ggml_opt_loss_type_sum(),
ggml_opt_loss_type_weighted_mse(),
ggml_opt_n_loss(),
ggml_opt_ncorrect(),
ggml_opt_optimizer_name(),
ggml_opt_optimizer_type_adamw(),
ggml_opt_optimizer_type_sgd(),
ggml_opt_outputs(),
ggml_opt_outputs_i(),
ggml_opt_pred(),
ggml_opt_prepare_alloc(),
ggml_opt_reset(),
ggml_opt_result_accuracy(),
ggml_opt_result_free(),
ggml_opt_result_init(),
ggml_opt_result_loss(),
ggml_opt_result_loss_i(),
ggml_opt_result_n_loss(),
ggml_opt_result_ndata(),
ggml_opt_result_pred(),
ggml_opt_result_reset(),
ggml_opt_set_lr(),
ggml_opt_static_graphs()