code: def scale_activations(module):
      from bigdl.llm.transformers.awq.act import ScaledActivation
  
      param = next(module.parameters())
      dtype = param.dtype
      device = param.device
      if isinstance(module, BloomBlock):
          if isinstance(module.mlp.gelu_impl, ScaledActivation):
              return
          c = module.mlp.dense_h_to_4h.out_features
          act = ScaledActivation(
              module.mlp.gelu_impl,
              torch.ones(c, dtype=dtype, device=device),
          )
          set_op_by_name(module, "mlp.gelu_impl", act)
      elif "mptblock" in str(module.__class__.__name__).lower():
          if isinstance(module.ffn.act, ScaledActivation):
              return
          c = module.ffn.up_proj.out_features
          act = ScaledActivation(
              module.ffn.act, torch.ones(c, dtype=dtype, device=device)
          )
          set_op_by_name(module, "ffn.act", act)
      elif "falcon" in str(module.__class__).lower():
          if isinstance(module.mlp.act, ScaledActivation):
              return
          c = module.mlp.dense_h_to_4h.out_features
          act = ScaledActivation(
              module.mlp.act, torch.ones(c, dtype=dtype, device=device)
          )
          set_op_by_name(module, "mlp.act", act)
      elif "bigcode" in str(module.__class__).lower():
          if isinstance(module.mlp.act, ScaledActivation):
              return
          c = module.mlp.c_proj.out_features
          act = ScaledActivation(
              module.mlp.act, torch.ones(c, dtype=dtype, device=device)
          )
          set_op_by_name(module, "mlp.act", act)
      elif "neox" in str(module.__class__).lower():
          if isinstance(module.mlp.act, ScaledActivation):
              return
          c = module.mlp.dense_h_to_4h.out_features
          act = ScaledActivation(
              module.mlp.act, torch.ones(c, dtype=dtype, device=device)
          )
          set_op_by_name(module, "mlp.act", act)
  
file_path: BigDL/python/llm/src/bigdl/llm/transformers/awq/awq.py
imports: import gc
  import os
  from tqdm import tqdm
  import torch
  import torch.nn
  from transformers.models.bloom.modeling_bloom import BloomForCausalLM
  from transformers.models.opt.modeling_opt import OPTForCausalLM
  from transformers.models.llama.modeling_llama import LlamaForCausalLM
  from transformers.models.bloom.modeling_bloom import BloomBlock
  from transformers import AwqConfig, AutoConfig
  from bigdl.llm.transformers.awq.linear import WQLinear_GEMM, WQLinear_GEMV
  from huggingface_hub import snapshot_download
  from bigdl.llm.utils.common import invalidInputError
label_desc: Use image node_id 6 for calling a global function with example usage: scale_activations(module) without return types