Class: Transformers::AutoConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/transformers/models/auto/configuration_auto.rb

Class Method Summary collapse

Class Method Details

.from_pretrained(pretrained_model_name_or_path, **kwargs) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/transformers/models/auto/configuration_auto.rb', line 49

def self.from_pretrained(pretrained_model_name_or_path, **kwargs)
  kwargs[:_from_auto] = true
  kwargs[:name_or_path] = pretrained_model_name_or_path
  _trust_remote_code = kwargs.delete(:trust_remote_code)
  _code_revision = kwargs.delete(:code_revision)

  config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  if config_dict[:model_type]
    config_class = CONFIG_MAPPING[config_dict[:model_type]]
    config_class.from_dict(config_dict, **unused_kwargs)
  else
    raise Todo
  end
end