tests/test_examples.py
def _get_supported_models_for_script(
    models_to_test: Dict[str, Tuple[str]], task_mapping: Dict[str, str]
) -> List[Tuple[str]]:
    """
    Filters models that can perform the task from models_to_test.

    Args:
        models_to_test: mapping between a model type and a tuple (model_name_or_path, ipu_config_name).
        task_mapping: mapping bewteen a model config and a model class.

    Returns:
        A list of models that are supported for the task.
        Each element of the list follows the same format: (model_type, (model_name_or_path, ipu_config_name)).
    """

    def is_valid_model_type(model_type: str, model_class: Type) -> bool:
        in_task_mapping = CONFIG_MAPPING[model_type] in task_mapping
        if in_task_mapping:
            return task_mapping[CONFIG_MAPPING[model_type]] in _PRETRAINED_TO_PIPELINED_REGISTRY
        return False

    return [
        (model_type, names) for (model_type, names) in models_to_test.items() if is_valid_model_type(model_type, names)
    ]

    Filters models that can perform the task from models_to_test.

    Args:
        models_to_test: mapping between a model type and a tuple (model_name_or_path, ipu_config_name).
        task_mapping: mapping bewteen a model config and a model class.

    Returns:
        A list of models that are supported for the task.
        Each element of the list follows the same format: (model_type, (model_name_or_path, ipu_config_name)).
    
Filters models that can perform the task from models_to_test.
Filters models that can perform the task from models_to_test .
def _get_supported_models_for_script(
    models_to_test: Dict[str, Tuple[str]], task_mapping: Dict[str, str]
) -> List[Tuple[str]]:
    def is_valid_model_type(model_type: str, model_class: Type) -> bool:
        in_task_mapping = CONFIG_MAPPING[model_type] in task_mapping
        if in_task_mapping:
            return task_mapping[CONFIG_MAPPING[model_type]] in _PRETRAINED_TO_PIPELINED_REGISTRY
        return False
    return [
        (model_type, names) for (model_type, names) in models_to_test.items() if is_valid_model_type(model_type, names)
    ]
def _get_supported_models_for_script ( models_to_test : Dict [ str , Tuple [ str ] ] , task_mapping : Dict [ str , str ] ) -> List [ Tuple [ str ] ] : def is_valid_model_type ( model_type : str , model_class : Type ) -> bool : in_task_mapping = CONFIG_MAPPING [ model_type ] in task_mapping if in_task_mapping : return task_mapping [ CONFIG_MAPPING [ model_type ] ] in _PRETRAINED_TO_PIPELINED_REGISTRY return False return [ ( model_type , names ) for ( model_type , names ) in models_to_test . items ( ) if is_valid_model_type ( model_type , names ) ]
Filters models that can perform the task from models_to_test.
Filters models that can perform the task from models_to_test .
"""
    Filters models that can perform the task from models_to_test.

    Args:
        models_to_test: mapping between a model type and a tuple (model_name_or_path, ipu_config_name).
        task_mapping: mapping bewteen a model config and a model class.

    Returns:
        A list of models that are supported for the task.
        Each element of the list follows the same format: (model_type, (model_name_or_path, ipu_config_name)).
    """
A list of models that are supported for the task.
Each element of the list follows the same format: (model_type, (model_name_or_path, ipu_config_name)).
A list of models that are supported for the task . Each element of the list follows the same format : ( model_type ( model_name_or_path ipu_config_name )) .
models_to_test
Dict[str, Tuple[str]]
mapping between a model type and a tuple (model_name_or_path, ipu_config_name).
mapping between a model type and a tuple ( model_name_or_path ipu_config_name ) .
task_mapping
Dict[str, str]
mapping bewteen a model config and a model class.
mapping bewteen a model config and a model class .