class_docstr: Tests the DeformableDETR trainer on single device setup.
class_docstr_tok: ["Tests","the","DeformableDETR","trainer","on","single","device","setup","."]
code: def setUp(self):
      super().setUp()
      self.test_dir = tempfile.mkdtemp()
      # Make sure tf does not allocate GPU memory.
      tf.config.experimental.set_visible_devices([], "GPU")
  
      self.config = mini_config.get_config()
      num_shards = jax.local_device_count()
      self.config.batch_size = num_shards * 2
      self.config.eval_batch_size = num_shards * 2
  
      self.model_cls = DeformableDETRModel
  
      with tfds.testing.mock_data(
          num_examples=50,
          as_dataset_fn=test_util.generate_fake_dataset(
              num_examples=50
          ),
      ):
          dataset_builder = datasets.get_dataset(
              self.config.dataset_name
          )
          self.dataset = dataset_builder(
              batch_size=self.config.batch_size,
              eval_batch_size=self.config.eval_batch_size,
              num_shards=num_shards,
              dtype_str=self.config.data_dtype_str,
              dataset_configs=self.config.dataset_configs,
          )
  
imports: import shutil
  import tempfile
  from absl.testing import absltest
  from absl.testing import parameterized
  from clu import metric_writers
  from jax import flatten_util
  import jax.numpy
  import jax.random
  import numpy
  from scenic.dataset_lib import datasets
  from scenic.projects.baselines.deformable_detr import trainer
  from scenic.projects.baselines.deformable_detr.configs import mini_config
  from scenic.projects.baselines.deformable_detr.model import DeformableDETRModel
  from scenic.projects.baselines.detr.tests import test_util
  import tensorflow
  import tensorflow_datasets
label_desc: Use image node_id 1 for calling the DETRTrainerTest obj's underlying member method code with example usage: obj.setUp() without return types