Skip to content

Commit

Permalink
document pytorch RNG
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Jan 11, 2025
1 parent 128686e commit ce27f0a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/guide/conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ parameter; if seed material is supplied, that seed should be considered part of
the configuration (see the source code in :mod:`lenskit.basic.random` for
examples).

Components that use randomization at **training time** should obtain their
generator or seed from the :attr:`~lenskit.training.TrainingOptions`. This
makes it easy to configure a seed for the training process without needing
to configure each component.
Components that use randomization at **training time** (e.g. to shuffle data or
to initialize parameter values) should obtain their generator or seed from the
:attr:`~lenskit.training.TrainingOptions`. This makes it easy to configure a
seed for the training process without needing to configure each component. For
consistent configurability, it's best for components using other frameworks such
as PyTorch to use NumPy to initialize the parameter values and then convert the
initial values to the appropriate compute backend.

Other LensKit code, such as the `data splitting support <./splitting>`_, follow
SPEC 7 directly by accepting an ``rng`` keyword parameter.
Expand Down

0 comments on commit ce27f0a

Please sign in to comment.