pyvene.models.configuration_intervenable_model.IntervenableConfig#
- class IntervenableConfig(representations=[(0, 'block_output', 'pos', 1, None, None, None, None, None, None, None, None, None, None)], intervention_types=<class 'pyvene.models.interventions.VanillaIntervention'>, mode='parallel', sorted_keys=None, model_type=None, intervention_dimensions=None, intervention_constant_sources=None, **kwargs)[source]#
Bases:
PretrainedConfig
- __init__(representations=[(0, 'block_output', 'pos', 1, None, None, None, None, None, None, None, None, None, None)], intervention_types=<class 'pyvene.models.interventions.VanillaIntervention'>, mode='parallel', sorted_keys=None, model_type=None, intervention_dimensions=None, intervention_constant_sources=None, **kwargs)[source]#
Methods
__init__
([representations, ...])add_intervention
(representations)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.
get_text_config
([decoder])Returns the config that is meant to be used with text IO.
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.