ToolsΒΆ
Transformers ModelsΒΆ
- onnxscript.tools.transformers_models.get_model_and_inputs(model: str, config: str, dynamic_shapes: bool, device: str = 'cpu', num_hidden_layers: int = 1, with_mask: bool = True, implementation: str = 'eager', dtype: str | None = None, warmup: int = 5, repeat: int = 10) tuple[Any, list[tuple[Tensor, ...]], dict | None] [source]ΒΆ
Returns a model and a couple of dummy inputs.
- Parameters:
model β model name, βphiβ, βllamaβ, βphi3β, β¦
config β βsmallβ, βmediumβ, βlargeβ, β¦
dynamic_shapes β dynamic or static shapes
device β βcpuβ or βcudaβ
num_hidden_layers β Number of hidden layers.
with_mask β One input or two inputs.
implementation β eager or sdpa
warmup β Number of inputs to generate.
repeat β Number of inputs to generate for repeat.
dtype β If specified, cast the model and the inputs into this type.
- Returns:
model and list of inputs
- onnxscript.tools.transformers_models.phi.get_phi_model_from_config(warmup: int = 5, repeat: int = 10, config: str = 'small', num_hidden_layers: int = 1, implementation: str = 'eager', dynamic_shapes: bool = False, with_mask: bool = True) tuple[Any, list[tuple[Tensor, ...]], dict] [source]ΒΆ
Returns a model Phi to test or benchmark.
- Parameters:
warmup β Number of inputs to generate.
repeat β Number of inputs to generate for repeat.
config β small, medium or large
num_hidden_layers β number of hidden layers
implementation β eager or sdpa
with_mask β One or two inputs.
dynamic_shapes β dynamic shapes or not
- Returns:
Model and list of inputs.
- onnxscript.tools.transformers_models.phi3.get_phi3_model_from_config(warmup: int = 5, repeat: int = 10, config: str = 'small', num_hidden_layers: int = 1, implementation: str = 'eager', dynamic_shapes: bool = False, with_mask: bool = True) tuple[Any, list[tuple[Tensor, ...]], dict] [source]ΒΆ
Returns a model Phi to test or benchmark.
- Parameters:
warmup β Number of inputs to generate.
repeat β Number of inputs to generate for repeat.
config β small, medium or large
num_hidden_layers β number of hidden layers
implementation β eager or sdpa
with_mask β One or two inputs.
dynamic_shapes β dynamic shapes or not
- Returns:
Model and list of inputs.
- onnxscript.tools.transformers_models.llama.get_llama_model_from_config(warmup: int = 5, repeat: int = 10, config: str = 'small', num_hidden_layers: int = 1, implementation: str = 'eager', dynamic_shapes: bool = False, with_mask: bool = True) tuple[Any, list[tuple[Tensor, ...]], dict] [source]ΒΆ
Returns a model Phi to test or benchmark.
- Parameters:
warmup β Number of inputs to generate.
repeat β Number of inputs to generate for repeat.
config β small, medium or large
num_hidden_layers β Number of hidden layers.
implementation β eager or sdpa
with_mask β One or two inputs.
dynamic_shapes β dynamic shapes or not
- Returns:
Model and list of inputs.