code: def _validate_token_classification(
      *,
      dataset: "TextData",
      predictions: Any = None,
      probabilities: Any = None,
  ):
      if probabilities is not None:
          raise ValidationError(
              "For token classification probabilities are not supported"
          )
  
      if predictions is not None:
          format_error_message = (
              "Check requires token-classification predictions for "
              f'the "{dataset.name}" dataset to be of a type '
              "sequence[sequence[str]] or sequence[sequence[int]]"
          )
          if not is_sequence_not_str(predictions):
              raise ValidationError(format_error_message)
          if len(predictions) != dataset.n_samples:
              raise ValidationError(
                  "Check requires token-classification predictions for "
                  f'the "{dataset.name}" dataset to have {dataset.n_samples} rows, '
                  "same as dataset"
              )
  
          for idx, sample_predictions in enumerate(predictions):
              if not is_sequence_not_str(sample_predictions):
                  raise ValidationError(format_error_message)
  
              predictions_types_counter = _count_types(
                  sample_predictions
              )
              criterias = (
                  str in predictions_types_counter,
                  int in predictions_types_counter,
              )
  
              if all(criterias) or not any(criterias):
                  raise ValidationError(format_error_message)
  
              tokenized_text = dataset.tokenized_text
  
              if len(sample_predictions) != len(tokenized_text[idx]):
                  raise ValidationError(
                      "Check requires token-classification predictions for "
                      f'the "{dataset.name}" dataset to have the same number of tokens '
                      "as the input text"
                  )
  
imports: import collections
  from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast
  import numpy
  import pandas
  from deepchecks.core.errors import DeepchecksValueError, ValidationError
  from deepchecks.nlp.task_type import TaskType, TTextLabel
  from deepchecks.utils.logger import get_logger
  from deepchecks.utils.metrics import is_label_none
  from deepchecks.utils.type_inference import infer_categorical_features, infer_numerical_features
  from deepchecks.utils.validation import is_sequence_not_str
label_desc: Use image node_id 10 for calling a global function with example usage: _validate_token_classification() without return types