architxt.utils

architxt.utils#

Functions

is_memory_low(threshold_mb)

Check if available system memory is below the specified threshold in MB.

windowed_shuffle(iterable[, window_size])

Shuffle an Iterable by yielding items in a randomized order using a sliding window buffer.

architxt.utils.is_memory_low(threshold_mb)[source]#

Check if available system memory is below the specified threshold in MB.

Return type:

bool

architxt.utils.windowed_shuffle(iterable, window_size=10)[source]#

Shuffle an Iterable by yielding items in a randomized order using a sliding window buffer.

Parameters:
  • iterable (Iterable[~T]) – Iterable to shuffle.

  • window_size (int) – Size of the sliding window buffer.

Yield:

Shuffled items.

Raises:

ValueError – If window_size is <= 1.

Return type:

Generator[~T, None, None]

architxt.utils.T = TypeVar(T)#

Type:    TypeVar

Invariant TypeVar.