class_docstr: A simple API for GPTQ Quantization
docstr: Convert the model to a GPTQ model by getting and replacing the layers.
  
  Args:
      model (`nn.Module`):
          Model to be converted
docstr_tok: ["Convert","the","model","to","a","GPTQ","model","by","getting","and","replacing","the","layers",".","Args",":","model","(","`","nn.Module","`",")",":","Model","to","be","converted"]
code: def convert_model(self, model: nn.Module):
      """
      Convert the model to a GPTQ model by getting and replacing the layers.
  
      Args:
          model (`nn.Module`):
              Model to be converted
  
      """
      if self.block_name_to_quantize is None:
          self.block_name_to_quantize = get_block_name_with_pattern(
              model
          )
      block_name = self.block_name_to_quantize
      layers_to_be_replaced = get_layers(model, prefix=block_name)
      if self.modules_in_block_to_quantize is not None:
          layers_to_keep = sum(self.modules_in_block_to_quantize, [])
          for name in list(layers_to_be_replaced.keys()):
              if not any(
                  name.endswith(layer) for layer in layers_to_keep
              ):
                  logger.info(
                      f"Quantization disabled for {name} (only modules_in_block_to_quantize={self.modules_in_block_to_quantize} are quantized)"
                  )
                  del layers_to_be_replaced[name]
      self._replace_by_quant_layers(model, layers_to_be_replaced)
      return model
  
imports: import json
  import os
  from enum import Enum
  from logging import getLogger
  from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
  from torch import nn
  from tqdm.auto import tqdm
  from transformers import AutoTokenizer
  from transformers.pytorch_utils import Conv1D
  from transformers.utils.quantization_config import QuantizationMethod
  from ..utils import is_accelerate_available, is_auto_gptq_available
  from ..utils.modeling_utils import recurse_getattr
  from .constants import GPTQ_CONFIG
  from .data import get_dataset, prepare_dataset
  from .utils import get_block_name_with_pattern, get_device, get_layers, get_preceding_modules, get_seqlen
label_desc: Use image node_id 4 for calling the GPTQQuantizer obj's underlying member method code with example usage: obj.convert_model(model) and returns: model