Natural Language Processing#

Parameters#

class archai.discrete_search.evaluators.nlp.parameters.NonEmbeddingParamsProxy(exclude_cls: List[Module] | None = None, trainable_only: bool | None = True)[source]#

Total number of non-embedding parameters.

evaluate(model: ArchaiModel, budget: float | None = None) float[source]#

Evaluate an ArchaiModel instance, optionally using a budget value.

Parameters:
  • arch – Model to be evaluated.

  • dataset – A dataset provider object.

  • budget – A budget multiplier value, used by search algorithms like SuccessiveHalving to specify how much compute should be spent in this evaluation. In order to use this type of search algorithm, the implementation of evaluate() must use the passed budget value accordingly.

Returns:

Evaluation result.

Transformer-Flex Latency#

class archai.discrete_search.evaluators.nlp.transformer_flex_latency.TransformerFlexOnnxLatency(search_space: TransformerFlexSearchSpace, providers: List[str] | None = None, batch_size: int | None = 1, seq_len: int | None = 192, past_seq_len: int | None = 0, n_trials: int | None = 1, use_median: bool | None = False, use_past: bool | None = True, validate: bool | None = True, share_weights: bool | None = True, opset: int | None = 11, optimize: bool | None = True, only_ort: bool | None = False)[source]#

Measure the average latency of models from the Transformer-Flex search space.

evaluate(arch: ArchaiModel, budget: float | None = None) float[source]#

Evaluate an ArchaiModel instance, optionally using a budget value.

Parameters:
  • arch – Model to be evaluated.

  • dataset – A dataset provider object.

  • budget – A budget multiplier value, used by search algorithms like SuccessiveHalving to specify how much compute should be spent in this evaluation. In order to use this type of search algorithm, the implementation of evaluate() must use the passed budget value accordingly.

Returns:

Evaluation result.

Transformer-Flex Memory#

class archai.discrete_search.evaluators.nlp.transformer_flex_memory.TransformerFlexOnnxMemory(search_space: TransformerFlexSearchSpace, use_past: bool | None = True, validate: bool | None = True, share_weights: bool | None = True, opset: int | None = 11, optimize: bool | None = True, only_ort: bool | None = False)[source]#

Measure the memory usage of models from the Transformer-Flex search space.

evaluate(arch: ArchaiModel, budget: float | None = None) float[source]#

Evaluate an ArchaiModel instance, optionally using a budget value.

Parameters:
  • arch – Model to be evaluated.

  • dataset – A dataset provider object.

  • budget – A budget multiplier value, used by search algorithms like SuccessiveHalving to specify how much compute should be spent in this evaluation. In order to use this type of search algorithm, the implementation of evaluate() must use the passed budget value accordingly.

Returns:

Evaluation result.