code: def _set_trainable(model, adapter_name):
      key_list = [key for key, _ in model.named_modules()]
      for key in key_list:
          target_module_found = any(
              key.endswith(target_key)
              for target_key in model.modules_to_save
          )
          if target_module_found:
              parent, target, target_name = _get_submodules(model, key)
              if isinstance(target, ModulesToSaveWrapper):
                  target.update(adapter_name)
                  target.set_adapter(target.active_adapter)
              else:
                  new_module = ModulesToSaveWrapper(
                      target, adapter_name
                  )
                  new_module.set_adapter(adapter_name)
                  setattr(parent, target_name, new_module)
  
imports: import copy
  import inspect
  import warnings
  from typing import Optional, Tuple
  import accelerate
  import torch
  from accelerate.hooks import add_hook_to_module, remove_hook_from_module
  from accelerate.utils import is_npu_available, is_xpu_available
  from safetensors.torch import storage_ptr, storage_size
  from ..import_utils import is_auto_gptq_available, is_torch_tpu_available
  from .constants import CONFIG_NAME, EMBEDDING_LAYER_NAMES, INCLUDE_LINEAR_LAYERS_SHORTHAND, SAFETENSORS_WEIGHTS_NAME, TRANSFORMERS_MODELS_TO_ADALORA_TARGET_MODULES_MAPPING, TRANSFORMERS_MODELS_TO_IA3_FEEDFORWARD_MODULES_MAPPING, TRANSFORMERS_MODELS_TO_IA3_TARGET_MODULES_MAPPING, TRANSFORMERS_MODELS_TO_LORA_TARGET_MODULES_MAPPING, TRANSFORMERS_MODELS_TO_PREFIX_TUNING_POSTPROCESS_MAPPING, WEIGHTS_NAME, bloom_model_postprocess_past_key_value, starcoder_model_postprocess_past_key_value
label_desc: Use image node_id 7 for calling a global function with example usage: _set_trainable(model, adapter_name) without return types