docstr: Upscales quantized weights of a model to fp16 and saves the result in a folder specified by save_path.
  
  Args:
      save_path (str): The path to the folder where the upscaled model weights will be saved.
  
  Returns:
      None
docstr_tok: ["Upscales","quantized","weights","of","a","model","to","fp16","and","saves","the","result","in","a","folder","specified","by","save_path",".","Args",":","save_path","(","str",")",":","The","path","to","the","folder","where","the","upscaled","model","weights","will","be","saved",".","Returns",":","None"]
code: def save_dequantized_base_model(self, save_path: str) -> None:
      """Upscales quantized weights of a model to fp16 and saves the result in a folder specified by save_path.
  
      Args:
          save_path (str): The path to the folder where the upscaled model weights will be saved.
  
      Returns:
          None
      """
      from peft import PeftModel
  
      if isinstance(self.model, PeftModel):
          # Get the base model back by removing all the adapter modules without merging.
          logger.warning(
              "LLM model is currently wrapped in a PeftModel. Removing the adapter layers and saving the base model."
              "Reload the model via LudwigModel.load() to use your trained adapter layers for inference."
          )
          self.model = self.model.unload()
  
      # Dequantize the model weights and cast them to fp16 - replace quantized layers with appropriate
      # linear layers in-place.
      logger.info("Upscaling quantized weights to fp16...")
      convert_quantized_linear_to_linear(self.model)
      logger.info("Done.")
  
      # Remove the quantization configuration from the model
      # The reason we can't delete the quantization config is because it is a property of the model and
      # HF does some weird serialization of the config that causes an error when trying to access `self.model.config`
      # after you try and delete a key from the config: TypeError: Object of type dtype is not JSON serializable.
      self.model.config.quantization_config = {}
  
      # Override properties of the model to indicate that it is no longer quantized.
      # This is also necessary to ensure that the model can be saved, otherwise it will raise an error like
      # "You are calling `save_pretrained` on a 4-bit converted model. This is currently not supported"
      # See: https://github.com/huggingface/transformers/blob/0ad4e7e6dad670a7151aaceb1af3c272a3bf73a8/src/transformers/modeling_utils.py#L2054 # noqa
      self.model.is_loaded_in_4bit = False
      self.model.is_loaded_in_8bit = False
  
      # Save the model
      logger.info(f"Saving upscaled model to {save_path}")
      self.model.save_pretrained(save_path)
      logger.info("Done.")
  
      # Save the tokenizer
      logger.info(f"Saving tokenizer to {save_path}")
      self.tokenizer.save_pretrained(save_path)
      logger.info("Done.")
  
imports: import contextlib
  import logging
  import os
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from transformers import AutoConfig, GenerationConfig
  from ludwig.accounting.used_tokens import get_used_tokens_for_llm
  from ludwig.constants import IGNORE_INDEX_TOKEN_ID, LOGITS, MODEL_LLM, PREDICTIONS, TEXT, USED_TOKENS
  from ludwig.features.base_feature import ModuleWrapper, OutputFeature
  from ludwig.features.feature_utils import LudwigFeatureDict
  from ludwig.features.text_feature import TextOutputFeature
  from ludwig.globals import MODEL_WEIGHTS_FILE_NAME
  from ludwig.models.base import BaseModel
  from ludwig.modules.training_hooks import NEFTuneHook
  from ludwig.schema.features.base import BaseOutputFeatureConfig, FeatureCollection
  from ludwig.schema.model_types.llm import LLMModelConfig
  from ludwig.utils.augmentation_utils import AugmentationPipelines
  from ludwig.utils.data_utils import clear_data_cache
  from ludwig.utils.llm_quantization_utils import convert_quantized_linear_to_linear
  from ludwig.utils.llm_utils import add_left_padding, generate_merged_ids, get_context_len, get_realigned_target_and_prediction_tensors_for_inference, initialize_adapter, load_pretrained_from_config, pad_target_tensor_for_fine_tuning, remove_left_padding, to_device
  from ludwig.utils.logging_utils import log_once
  from ludwig.utils.output_feature_utils import set_output_feature_tensor
  from ludwig.utils.tokenizers import HFTokenizer
  from ludwig.utils.torch_utils import reg_loss
label_desc: Use image node_id 26 for calling the LLM obj's underlying member method code with example usage: obj.save_dequantized_base_model(save_path) without return types