pyvene.models.mlp.modelings_mlp.MLPConfig

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_torch_dtype_to_str(d)

Checks whether the passed dictionary and its nested dicts have a torch_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.

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.

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 config which correspond to the default config attributes for better readability and serializes to a Python dictionary.

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_map

is_composition

model_type

name_or_path

num_labels

int: The number of labels for classification models.

use_return_dict

bool: Whether or not return [~utils.ModelOutput] instead of tuples.