std1.0.0-beta-7 SafeC docs

std :: ml::trainer

Struct std::TrainConfig

#include <std/ml/trainer.h> source

struct TrainConfig {
    unsigned long epochs;
    unsigned long batchSize;
    unsigned long seed;
    int shuffle;
    float clipNorm;
    float lrDecay;
    int device;
    int precision;
}

Fields

§unsigned long epochssource
§unsigned long batchSizesource
§unsigned long seedsource

shuffling

§int shufflesource
§float clipNormsource

0: clip the global gradient norm to this

§float lrDecaysource

lr *= lrDecay after every epoch (1 = constant)

§int devicesource

Where to train (device.h): the optimizer's parameters are placed there when fitting starts and stay there (model_to(&m, DEVICE_CPU) or model_sync brings them back). DEVICE_CPU (the default) leaves them where they are; DEVICE_AUTO picks device_default(). The dataset is uploaded once and each batch gathered on the device.

§int precisionsource

What that device's convolutions and matrix products compute in while fitting (device.h's DEVICE_FP32, DEVICE_FP16 with a dynamic loss scale, DEVICE_BF16); the device's previous precision comes back afterwards. DEVICE_PRECISION_KEEP (the default) uses the device's own setting (device_set_precision).

Methods

§static struct TrainConfig default()source · definition

epochs 10, batch 32, seed 1, shuffled, no clipping, constant lr, no device change, the device's precision.