code: def from_pretrained(
      cls, pretrained_model_name_or_path, *model_args, **kwargs
  ):
      config = kwargs.pop("config", None)
      trust_remote_code = kwargs.pop("trust_remote_code", False)
      kwargs["_from_auto"] = True
      if not isinstance(config, PretrainedConfig):
          config, kwargs = AutoConfig.from_pretrained(
              pretrained_model_name_or_path,
              return_unused_kwargs=True,
              **kwargs,
          )
      if (
          hasattr(config, "auto_map")
          and cls.__name__ in config.auto_map
      ):
          if not trust_remote_code:
              raise ValueError(
                  f"Loading {pretrained_model_name_or_path} requires you to execute the modeling file in that repo "
                  "on your local machine. Make sure you have read the code there to avoid malicious use, then set "
                  "the option `trust_remote_code=True` to remove this error."
              )
          if kwargs.get("revision", None) is None:
              logger.warning(
                  "Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure "
                  "no malicious code has been contributed in a newer revision."
              )
          class_ref = config.auto_map[cls.__name__]
          module_file, class_name = class_ref.split(".")
          model_class = get_class_from_dynamic_module(
              pretrained_model_name_or_path,
              module_file + ".py",
              class_name,
              **kwargs,
          )
          return model_class.from_pretrained(
              pretrained_model_name_or_path,
              *model_args,
              config=config,
              **kwargs,
          )
      elif type(config) in cls._model_mapping.keys():
          model_class = _get_model_class(config, cls._model_mapping)
          return model_class.from_pretrained(
              pretrained_model_name_or_path,
              *model_args,
              config=config,
              **kwargs,
          )
      raise ValueError(
          f"Unrecognized configuration class {config.__class__} for this kind of AutoModel: {cls.__name__}.\n"
          f"Model type should be one of {', '.join(c.__name__ for c in cls._model_mapping.keys())}."
      )
  
imports: import importlib
  from collections import OrderedDict
  from .configuration_auto import AutoConfig, model_type_to_module_name, replace_list_option_in_docstrings
  from .dynamic import get_class_from_dynamic_module
  from fastNLP.transformers.torch.configuration_utils import PretrainedConfig
  from fastNLP.transformers.torch.file_utils import copy_func
  from fastNLP.core.log import logger
label_desc: Use image node_id 3 for calling the _BaseAutoModelClass obj's underlying member method code with example usage: obj.from_pretrained(cls, pretrained_model_name_or_path) and returns: model_class, model_class