code: def quantized(
      self,
      tokenizer,
      dataset,
      num_samples=512,
      seq_len=512,
      alpha=0.5,
  ):
      llama_model = self.model
      llama_config = llama_model.config
  
      act_scales = self.get_act_scales(
          llama_model, tokenizer, dataset, num_samples, seq_len
      )
  
      self.smooth_fn(act_scales, alpha)
  
      act_dict = self.get_act_dict(
          tokenizer, dataset, num_samples, seq_len
      )
      decoder_layer_scales = []
  
      for idx in range(llama_config.num_hidden_layers):
          scale_dict = {}
          scale_dict["attn_input_scale"] = (
              act_dict[f"model.layers.{idx}.self_attn.q_proj"]["input"]
              / 127
          )
          scale_dict["q_output_scale"] = (
              act_dict[f"model.layers.{idx}.self_attn.q_proj"]["output"]
              / 127
          )
          scale_dict["k_output_scale"] = (
              act_dict[f"model.layers.{idx}.self_attn.k_proj"]["output"]
              / 127
          )
          scale_dict["v_output_scale"] = (
              act_dict[f"model.layers.{idx}.self_attn.v_proj"]["output"]
              / 127
          )
  
          scale_dict["q_rotary_output_scale"] = (
              act_dict[f"model.layers.{idx}.self_attn.q_apply_rotary"][
                  "output"
              ]
              / 127
          )
          scale_dict["k_rotary_output_scale"] = (
              act_dict[f"model.layers.{idx}.self_attn.k_apply_rotary"][
                  "output"
              ]
              / 127
          )
  
          scale_dict["out_input_scale"] = (
              act_dict[f"model.layers.{idx}.self_attn.o_proj"]["input"]
              / 127
          )
  
          scale_dict["gate_input_scale"] = (
              act_dict[f"model.layers.{idx}.mlp.gate_proj"]["input"]
              / 127
          )
          scale_dict["up_input_scale"] = (
              act_dict[f"model.layers.{idx}.mlp.up_proj"]["input"] / 127
          )
          scale_dict["down_input_scale"] = (
              act_dict[f"model.layers.{idx}.mlp.down_proj"]["input"]
              / 127
          )
  
          decoder_layer_scales.append(scale_dict)
  
      for i, layer in enumerate(llama_model.model.layers):
          orig_layer = layer
          llama_model.model.layers[
              i
          ] = LlamaSmoothquantDecoderLayer.pack(
              orig_layer, **decoder_layer_scales[i]
          )
  
      llama_model.model.forward = types.MethodType(
          llama_model_forward, llama_model.model
      )
  
      cos, sin = init_to_get_rotary(llama_config)
      llama_model.model.register_buffer(
          "_cos_cached", cos.to(self.model.device)
      )
      llama_model.model.register_buffer(
          "_sin_cached", sin.to(self.model.device)
      )
  
imports: import math
  import os
  import types
  from collections import defaultdict
  from functools import partial
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from torch_int.nn.bmm import BMM_S8T_S8N_F32T, BMM_S8T_S8N_S8T
  from transformers import PreTrainedModel
  from transformers.modeling_outputs import BaseModelOutputWithPast
  from transformers.models.llama.configuration_llama import LlamaConfig
  from transformers.models.llama.modeling_llama import LLAMA_INPUTS_DOCSTRING, LlamaAttention, LlamaDecoderLayer, LlamaMLP, LlamaRotaryEmbedding, repeat_kv, rotate_half
  from transformers.utils import add_start_docstrings_to_model_forward
  from colossalai.inference.tensor_parallel.batch_infer_state import BatchInferState
  from colossalai.kernel.triton import copy_kv_cache_to_dest, int8_rotary_embedding_fwd, smooth_llama_context_attn_fwd, smooth_token_attention_fwd
  from .base_model import BaseSmoothForCausalLM
  from .linear import W8A8B8O8Linear, W8A8BFP32O32LinearSiLU, W8A8BFP32OFP32Linear
label_desc: Use image node_id 5 for calling the SmoothLlamaForCausalLM obj's underlying member method code with example usage: obj.quantized(tokenizer, dataset, num_samples, seq_len, alpha) without return types