Save a configuration object to the directory `save_directory`, so that it can be re-loaded using the :func:`~transformers.PretrainedConfig.from_pretrained` class method. Args: save_directory (:obj:`string`): Directory where the configuration JSON
(self, save_directory)
| 124 | self.label2id = dict(zip(self.id2label.values(), self.id2label.keys())) |
| 125 | |
| 126 | def save_pretrained(self, save_directory): |
| 127 | """ |
| 128 | Save a configuration object to the directory `save_directory`, so that it |
| 129 | can be re-loaded using the :func:`~transformers.PretrainedConfig.from_pretrained` class method. |
| 130 | |
| 131 | Args: |
| 132 | save_directory (:obj:`string`): |
| 133 | Directory where the configuration JSON file will be saved. |
| 134 | """ |
| 135 | if os.path.isfile(save_directory): |
| 136 | raise AssertionError("Provided path ({}) should be a directory, not a file".format(save_directory)) |
| 137 | os.makedirs(save_directory, exist_ok=True) |
| 138 | # If we save using the predefined names, we can load using `from_pretrained` |
| 139 | output_config_file = os.path.join(save_directory, CONFIG_NAME) |
| 140 | |
| 141 | self.to_json_file(output_config_file, use_diff=True) |
| 142 | logger.info("Configuration saved in {}".format(output_config_file)) |
| 143 | |
| 144 | @classmethod |
| 145 | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs) -> "PretrainedConfig": |
nothing calls this directly
no test coverage detected