deeplake.random.seed

class deeplake.core.seed.DeeplakeRandom
get_seed() Optional[int]

Returns the seed which set to the deeplake to control the flows

seed(seed: Optional[int] = None)

Set random seed to the deeplake engines

Parameters

seed (int, optional) – Integer seed for initializing the computational engines, used for bringing reproducibility to random operations. Set to None to reset the seed. Defaults to None.

Raises

TypeError – If the provided value type is not supported.

Background

Specify a seed to train models and run randomized Deep Lake operations reproducibly. Features affected are:

  • Dataloader shuffling

  • Sampling and random operations in Tensor Query Language (TQL)

  • Dataset.random_split

The random seed can be specified using deeplake.random.seed:

>>> import deeplake
>>> deeplake.random.seed(0)

Random number generators in other libraries

The Deep Lake random seed does not affect random number generators in other libraries such as numpy.

However, seeds in other libraries will affect code where Deep Lake uses those libraries, but it will not impact the methods above where Deep Lake uses its internal seed.