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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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]#
-
- 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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]#
-
- 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
Moduleinstance 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]#
-
- 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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.DynamicCacheis passed directly as an input argument instead of being assembled insideforward.The model accepts two positional arguments:
x–(batch, nheads, seq, dim)float32cache–transformers.cache_utils.DynamicCachewith 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.DynamicCachefrom those reduced tensors. Returns(x, new_cache)wherenew_cacheis the reduced cache. Requirestransformersandyobx.torch.flatten.register_flattening_functions()to export.
- class yobx.torch.testing._model_eval_cases.DynamicCacheInputMixedLayers(*args: Any, **kwargs: Any)[source]#
Eval case where a
transformers.cache_utils.DynamicCachewith mixed layer types is passed directly as an input argument.The model accepts two positional arguments:
x–(batch, nheads, seq, dim)float32cache–transformers.cache_utils.DynamicCachewith two layers of different types: aDynamicLayer(layer 0) and aDynamicSlidingWindowLayer(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.DynamicCachefrom those reduced tensors, preserving the original layer types. Returns(x, new_cache)wherenew_cacheis the reduced cache. Requirestransformers>= 4.57 andyobx.torch.flatten.register_flattening_functions()to export.
- 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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-LLMas a minimal eval case.The wrapper accepts the five positional arguments listed below, assembles a
transformers.cache_utils.DynamicCachefrom the two past-KV tensors, and runs the innerAutoModelForCausalLMmodel. Returns thelogitstensor only so that all inputs and outputs are plaintorch.Tensorobjects.Positional arguments:
input_ids–(batch, seq_length)int64attention_mask–(batch, past_length + seq_length)int64position_ids–(batch, seq_length)int64past_key_0–(batch, n_heads, past_length, head_dim)float32past_value_0–(batch, n_heads, past_length, head_dim)float32
- 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
Moduleinstance 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
Moduleinstance 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
Moduleinstance 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 withtorch.export.export()when the function is called with non tensors arguments and the batch size is dynamic.