pyvene.models.mlp.modelings_mlp.MLPConfig#
- class MLPConfig(include_emb=False, vocab_size=50257, max_position_embeddings=512, n_layer=2, h_dim=512, num_classes=2, activation_function='gelu', pdrop=0.3, problem_type='single_label_classification', include_bias=True, squeeze_output=True, **kwargs)[source]#
Bases:
PretrainedConfig- __init__(include_emb=False, vocab_size=50257, max_position_embeddings=512, n_layer=2, h_dim=512, num_classes=2, activation_function='gelu', pdrop=0.3, problem_type='single_label_classification', include_bias=True, squeeze_output=True, **kwargs)[source]#
Methods
__init__([include_emb, vocab_size, ...])dict_dtype_to_str(d)Checks whether the passed dictionary and its nested dicts have a dtype key and if it's not None, converts torch.dtype to a string of just the type.
from_dict(config_dict, **kwargs)Instantiates a [PretrainedConfig] from a Python dictionary of parameters.
from_json_file(json_file)Instantiates a [PretrainedConfig] from the path to a JSON file of parameters.
from_pretrained(pretrained_model_name_or_path)Instantiate a [PretrainedConfig] (or a derived class) from a pretrained model configuration.
from_text_audio_configs(text_config, ...)Instantiate a model config (or a derived class) from text model configuration and audio model configuration.
from_text_vision_configs(text_config, ...)Instantiate a model config (or a derived class) from text model configuration and vision model configuration.
get_config_dict(...)From a pretrained_model_name_or_path, resolve to a dictionary of parameters, to be used for instantiating a [PretrainedConfig] using from_dict.
get_text_config([decoder, encoder])Returns the text config related to the text input (encoder) or text output (decoder) of the model.
push_to_hub(repo_id[, use_temp_dir, ...])Upload the configuration file to the 🤗 Model Hub.
register_for_auto_class([auto_class])Register this class with a given auto class.
save_pretrained(save_directory[, push_to_hub])Save a configuration object to the directory save_directory, so that it can be re-loaded using the [~PretrainedConfig.from_pretrained] class method.
to_dict()Serializes this instance to a Python dictionary.
to_diff_dict()Removes all attributes from the configuration that correspond to the default config attributes for better readability, while always retaining the config attribute from the class.
to_json_file(json_file_path[, use_diff])Save this instance to a JSON file.
to_json_string([use_diff])Serializes this instance to a JSON string.
update(config_dict)Updates attributes of this class with attributes from config_dict.
update_from_string(update_str)Updates attributes of this class with attributes from update_str.
Attributes
attribute_mapbase_config_keybase_model_ep_planbase_model_pp_planbase_model_tp_planhas_no_defaults_at_initmodel_typename_or_pathnum_labelsint: The number of labels for classification models.
output_attentionsbool: Whether or not the model should returns all attentions.
sub_configstorch_dtypeuse_return_dictbool: Whether or not return [~utils.ModelOutput] instead of tuples.