| ggml_set_seed | R Documentation |
Fixes the random seed used by ggmlR for everything that is stochastic:
weight initialisation (sequential, functional and autograd layers),
dropout masks (training-time),
data shuffling in the autograd dataloader / training loops.
ggml_set_seed(seed)
seed |
A single integer (or value coercible to integer) used as the RNG
seed. |
This is a thin wrapper around set.seed: all randomness in
ggmlR is produced by the base R RNG, so a fixed seed gives identical starting
weights, dropout masks and batch ordering across runs. It is the single point
of control used by the mlr3 learners (seed hyperparameter) and
the parsnip "ggml" engine (seed engine argument).
GPU note: this controls the random *inputs* to the computation, not the floating-point arithmetic itself. GPU (Vulkan) kernels are run-to-run stable on a given device/driver for the standard forward/backward paths, but ggmlR does not guarantee bit-for-bit identical results across different devices, drivers or backends (CPU vs Vulkan). Reproducibility is at the level of training dynamics, not exact bits.
Invisibly returns seed.
set.seed
ggml_set_seed(42)
a <- runif(3)
ggml_set_seed(42)
b <- runif(3)
identical(a, b) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.