code: def get_model_and_tokenizer(
      model_type,
      model_name,
      tokenizer_name,
      num_classes,
      state_dict,
      huggingface_config_path=None,
  ):
      model_class = getattr(transformers, model_name)
      model = model_class.from_pretrained(
          pretrained_model_name_or_path=None,
          config=huggingface_config_path or model_type,
          num_labels=num_classes,
          state_dict=state_dict,
          local_files_only=huggingface_config_path is not None,
      )
      tokenizer = getattr(transformers, tokenizer_name).from_pretrained(
          huggingface_config_path or model_type,
          local_files_only=huggingface_config_path is not None,
          # TODO: may be needed to let it work with Kaggle competition
          # model_max_length=512,
      )
  
      return model, tokenizer
  
file_path: detoxify/detoxify/detoxify.py
imports: import torch
  import transformers
label_desc: Use image node_id 1 for calling a global function with example usage: get_model_and_tokenizer(model_type, model_name, tokenizer_name, num_classes, state_dict, huggingface_config_path) and returns: model,  tokenizer