class_docstr: A simple API for GPTQ Quantization
docstr: Save model state dict and configs
  
  Args:
      model (`nn.Module`):
          Model to be saved. The model can be wrapped or unwraped.
      save_dir (`str`):
          Directory to which to save. Will be created if it doesn't exist.
      max_shard_size (`str`, defaults to `"10GB"`):
          The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
          lower than this size. If expressed as a string, needs to be digits followed by a unit (like `"5MB"`).
          <Tip warning={true}>
  
          If a single weight of the model is bigger than `max_shard_size`, it will be in its own checkpoint shard
          which will be bigger than `max_shard_size`.
  
          </Tip>
      safe_serialization (`bool`, defaults to `True`):
          Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
docstr_tok: ["Save","model","state","dict","and","configs","Args",":","model","(","`","nn.Module","`",")",":","Model","to","be","saved",".","The","model","can","be","wrapped","or","unwraped",".","save_dir","(","`","str","`",")",":","Directory","to","which","to","save",".","Will","be","created","if","it","does","n't","exist",".","max_shard_size","(","`","str","`",",","defaults","to","`","``","10GB","''","`",")",":","The","maximum","size","for","a","checkpoint","before","being","sharded",".","Checkpoints","shard","will","then","be","each","of","size","lower","than","this","size",".","If","expressed","as","a","string",",","needs","to","be","digits","followed","by","a","unit","(","like","`","``","5MB","''","`",")",".","<","Tip","warning=","{","true","}",">","If","a","single","weight","of","the","model","is","bigger","than","`","max_shard_size","`",",","it","will","be","in","its","own","checkpoint","shard","which","will","be","bigger","than","`","max_shard_size","`",".","<","\/Tip",">","safe_serialization","(","`","bool","`",",","defaults","to","`","True","`",")",":","Whether","to","save","the","model","using","`","safetensors","`","or","the","traditional","PyTorch","way","(","that","uses","`","pickle","`",")","."]
code: def save(
      self,
      model: nn.Module,
      save_dir: str,
      max_shard_size: str = "10GB",
      safe_serialization: bool = True,
  ):
      """
      Save model state dict and configs
  
      Args:
          model (`nn.Module`):
              Model to be saved. The model can be wrapped or unwraped.
          save_dir (`str`):
              Directory to which to save. Will be created if it doesn't exist.
          max_shard_size (`str`, defaults to `"10GB"`):
              The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
              lower than this size. If expressed as a string, needs to be digits followed by a unit (like `"5MB"`).
              <Tip warning={true}>
  
              If a single weight of the model is bigger than `max_shard_size`, it will be in its own checkpoint shard
              which will be bigger than `max_shard_size`.
  
              </Tip>
          safe_serialization (`bool`, defaults to `True`):
              Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
  
      """
      os.makedirs(save_dir, exist_ok=True)
      model.save_pretrained(
          save_dir,
          max_shard_size=max_shard_size,
          safe_serialization=safe_serialization,
      )
      with open(
          os.path.join(save_dir, GPTQ_CONFIG), "w", encoding="utf-8"
      ) as f:
          json.dump(self.to_dict(), f, indent=2)
  
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 10 for calling the GPTQQuantizer obj's underlying member method code with example usage: obj.save(model, save_dir, max_shard_size, safe_serialization) without return types