code: def check_training(self, config, input_values, *args):
      model = TFHubertForCTC(config)
  
      # freeze feature encoder
      model.freeze_feature_encoder()
  
      input_values = input_values[:3]
  
      input_lengths = tf.constant(
          [input_values.shape[-1] // i for i in [4, 2, 1]]
      )
      max_length_labels = model.hubert._get_feat_extract_output_lengths(
          input_lengths
      )
      labels = ids_tensor(
          (input_values.shape[0], max(max_length_labels) - 2),
          model.config.vocab_size,
      )
  
      length_mask = tf.sequence_mask(input_lengths, dtype=tf.float32)
  
      input_values = input_values * length_mask
  
      pad_size = max(max_length_labels) - labels.shape[1]
      labels = tf.pad(
          labels, ((0, 0), (0, pad_size)), constant_values=-100
      )
  
      loss = model(input_values, labels=labels, training=True).loss
  
      self.parent.assertFalse(tf.math.is_inf(loss))
  
imports: import copy
  import inspect
  import math
  import unittest
  import numpy
  import pytest
  from transformers import is_tf_available
  from transformers.testing_utils import require_soundfile, require_tf, slow
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
label_desc: Use image node_id 6 for calling the TFHubertModelTester obj's underlying member method code with example usage: obj.check_training(config, input_values) without return types