def _get_target_details(
    targets: List[Any],
    target_formatter_type: Type[TargetFormatter],
) -> Tuple[Optional[List[Any]], int]:
    """Given a list of targets and their ``TargetFormatter`` type, this function determines the ``labels`` and
    ``num_classes``. Targets can be:

    * Token-based: ``labels`` is the unique tokens, ``num_classes`` is the number of unique tokens.
    * Numeric: ``labels`` is ``None`` and ``num_classes`` is the maximum value plus one.
    * Binary: ``labels`` is ``None`` and ``num_classes`` is the length of the binary target.

    Args:
        targets: A list of targets.
        target_formatter_type: The ``TargetFormatter`` type.

    Returns:
        (labels, num_classes): Tuple containing the inferred ``labels`` (or ``None`` if no labels could be inferred)
        and ``num_classes``.

    """
    targets = _as_list(targets)
    if target_formatter_type.numeric:
        # Take a max over all values
        if target_formatter_type is MultiNumericTargetFormatter:
            values = []
            for target in targets:
                values.extend(target)
        else:
            values = targets
        num_classes = _as_list(max(values))
        if _is_list_like(num_classes):
            num_classes = num_classes[0]
        num_classes = num_classes + 1
        labels = None
    elif target_formatter_type.binary or (target_formatter_type is MultiSoftTargetFormatter):
        # Take a length
        # TODO: Add a check here and error if target lengths are not all equal
        num_classes = len(targets[0])
        labels = None
    else:
        # Compute tokens
        tokens = []
        if target_formatter_type is CommaDelimitedMultiLabelTargetFormatter:
            for target in targets:
                tokens.extend(target.split(","))
        elif target_formatter_type is SpaceDelimitedTargetFormatter:
            for target in targets:
                tokens.extend(target.split(" "))
        elif target_formatter_type is MultiLabelTargetFormatter:
            for target in targets:
                tokens.extend(target)
        else:
            tokens = targets

        tokens = [_strip(token) for token in tokens]
        labels = list(sorted_alphanumeric(set(tokens)))
        num_classes = None
    return labels, num_classes
Given a list of targets and their ``TargetFormatter`` type, this function determines the ``labels`` and
    ``num_classes``. Targets can be:

    * Token-based: ``labels`` is the unique tokens, ``num_classes`` is the number of unique tokens.
    * Numeric: ``labels`` is ``None`` and ``num_classes`` is the maximum value plus one.
    * Binary: ``labels`` is ``None`` and ``num_classes`` is the length of the binary target.

    Args:
        targets: A list of targets.
        target_formatter_type: The ``TargetFormatter`` type.

    Returns:
        (labels, num_classes): Tuple containing the inferred ``labels`` (or ``None`` if no labels could be inferred)
        and ``num_classes``.

    
src/flash/core/data/utilities/classification.py