yobx.torch.testing._model_eval_cases#

class yobx.torch.testing._model_eval_cases.AtenAsStrided[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.AtenInterpolate(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.AtenNonZero(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.AtenNonZeroTuple(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.AtenRollPos(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.AtenRollRelu(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.BuildInIsInstance(n_dims: int = 3, n_targets: int = 1)[source]#
forward(x, lx: list | Tensor)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.BuildInLen(n_dims: int = 3, n_targets: int = 1)[source]#
forward(x, lx: list)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ComplexPolar(*args: Any, **kwargs: Any)[source]#
forward(x, angle)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowCond(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowCond2Inputs(*args: Any, **kwargs: Any)[source]#
forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowCond2Outputs(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowCondConstant(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowCondIdentity_153832(*args: Any, **kwargs: Any)[source]#

#153832

forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowCondNestedModule[source]#
class Submodule[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowCondNonZero(*args: Any, **kwargs: Any)[source]#
forward(input_ids, image_features, vocab_size)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowIndirectRanks(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowIndirectRanksCat(*args: Any, **kwargs: Any)[source]#
forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowNestCond(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowNumelZero1(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowNumelZero2(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowNumelZero3(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowNumelZero4(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowNumelZero5(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowRanks(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowRanksType(*args: Any, **kwargs: Any)[source]#
forward(x=None)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowScan(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowScan2Carried(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowScanCDist(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowScanCDist2(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowScanCDistXY(*args: Any, **kwargs: Any)[source]#
forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowScanDecomposition_151564(*args: Any, **kwargs: Any)[source]#

#151564

forward(images, position)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowScanInplace_153705(*args: Any, **kwargs: Any)[source]#

#153705

forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowShapeCheck(*args: Any, **kwargs: Any)[source]#
forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowWhile(*args: Any, **kwargs: Any)[source]#
forward(ci, a, b)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowWhileDec(*args: Any, **kwargs: Any)[source]#
forward(ci, a, b)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ControlFlowWhileInc(*args: Any, **kwargs: Any)[source]#
forward(ci, a, b)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.CreateFromShape(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.CreateFromShapeThroughFunction(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.CropLastDimensionWithTensorContent(*args: Any, **kwargs: Any)[source]#
forward(x, shape)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.CropLastDimensionWithTensorShape(*args: Any, **kwargs: Any)[source]#
forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.DynamicCacheInput(*args: Any, **kwargs: Any)[source]#

Eval case where a transformers.cache_utils.DynamicCache is passed directly as an input argument instead of being assembled inside forward.

The model accepts two positional arguments:

  • x(batch, nheads, seq, dim) float32

  • cachetransformers.cache_utils.DynamicCache with two layers, each (batch, nheads, past_seq, dim)

For every layer in the cache, reduces the key and value tensors over the sequence dimension (dim 2) and assembles a new transformers.cache_utils.DynamicCache from those reduced tensors. Returns (x, new_cache) where new_cache is the reduced cache. Requires transformers and yobx.torch.flatten.register_flattening_functions() to export.

forward(x, cache)[source]#

Reduces each cache layer over dim 2 and returns (x, new_cache).

class yobx.torch.testing._model_eval_cases.DynamicCacheInputMixedLayers(*args: Any, **kwargs: Any)[source]#

Eval case where a transformers.cache_utils.DynamicCache with mixed layer types is passed directly as an input argument.

The model accepts two positional arguments:

  • x(batch, nheads, seq, dim) float32

  • cachetransformers.cache_utils.DynamicCache with two layers of different types: a DynamicLayer (layer 0) and a DynamicSlidingWindowLayer (layer 1).

For every layer in the cache, reduces the key and value tensors over the sequence dimension (dim 2) and assembles a new transformers.cache_utils.DynamicCache from those reduced tensors, preserving the original layer types. Returns (x, new_cache) where new_cache is the reduced cache. Requires transformers >= 4.57 and yobx.torch.flatten.register_flattening_functions() to export.

forward(x, cache)[source]#

Reduces each cache layer over dim 2 and returns (x, new_cache).

class yobx.torch.testing._model_eval_cases.ExportWithDimension0(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ExportWithDimension1(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ExportWithNewConstant(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ExportWithNewConstantTo(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceAdd[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceAdd2[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceAdd_Mul[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceCloneAdd_[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceSetItemEllipsis_1[source]#
forward(index, update)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceSetItemEllipsis_2[source]#
forward(index, update)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceSetItemExp(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceSetItemMask(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceSetItemSquare(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceSetItemSquareAdd(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.InplaceSetItemSquareAdd2(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.LayerNorm[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ShapeAndTypeAndDeviceBased(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ShapeAndTypeBased(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.ShapeBased(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.SignatureFloat1(n_dims: int = 3, n_targets: int = 1)[source]#
forward(x, alpha: float = 2.0)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.SignatureInt1(n_dims: int = 3, n_targets: int = 1)[source]#
forward(x, i: int = 2)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.SignatureInt2(n_dims: int = 3, n_targets: int = 1)[source]#
forward(x, i: int = 2)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.SignatureListFixedLength(n_dims: int = 3, n_targets: int = 1)[source]#
forward(x, lx: list)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.SignatureListFixedWithNone(*args: Any, **kwargs: Any)[source]#
forward(lx)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.SignatureListVariableLength(n_dims: int = 3, n_targets: int = 1)[source]#
forward(x, lx: list)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.SignatureShapeAsIndex(n_dims: int = 3, n_targets: int = 1)[source]#
forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.TinyLLM[source]#

Wraps arnir0/Tiny-LLM as a minimal eval case.

The wrapper accepts the five positional arguments listed below, assembles a transformers.cache_utils.DynamicCache from the two past-KV tensors, and runs the inner AutoModelForCausalLM model. Returns the logits tensor only so that all inputs and outputs are plain torch.Tensor objects.

Positional arguments:

  • input_ids(batch, seq_length) int64

  • attention_mask(batch, past_length + seq_length) int64

  • position_ids(batch, seq_length) int64

  • past_key_0(batch, n_heads, past_length, head_dim) float32

  • past_value_0(batch, n_heads, past_length, head_dim) float32

forward(input_ids, attention_mask, position_ids, past_key_0, past_value_0)[source]#

Performs the forward pass and returns the logits tensor.

class yobx.torch.testing._model_eval_cases.TypeBFloat16(*args: Any, **kwargs: Any)[source]#
forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.Vmap(*args: Any, **kwargs: Any)[source]#
forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class yobx.torch.testing._model_eval_cases.VmapPython(*args: Any, **kwargs: Any)[source]#
forward(x, y)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

yobx.torch.testing._model_eval_cases.patched_vmap(func, in_dims=0, out_dims=0, use_scan: bool = False)[source]#

Python implementation of torch.vmap(). The implementation raises an issue when it is being exported with torch.export.export() when the function is called with non tensors arguments and the batch size is dynamic.