code: def quantize(self, model):
      # Helper function that quantizes the given model
      # Recursively convert all the `quant_mode` attributes as `True`
      if hasattr(model, "quant_mode"):
          model.quant_mode = True
      elif type(model) == nn.Sequential:
          for n, m in model.named_children():
              self.quantize(m)
      elif type(model) == nn.ModuleList:
          for n in model:
              self.quantize(n)
      else:
          for attr in dir(model):
              mod = getattr(model, attr)
              if isinstance(mod, nn.Module) and mod != model:
                  self.quantize(mod)
  
imports: import copy
  import unittest
  from transformers import IBertConfig, is_torch_available
  from transformers.testing_utils import require_torch, slow, torch_device
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 10 for calling the IBertModelIntegrationTest obj's underlying member method code with example usage: obj.quantize(model) without return types