Update configuration_gptbert.py
Browse files- configuration_gptbert.py +0 -31
configuration_gptbert.py
CHANGED
|
@@ -80,34 +80,3 @@ class GptBertConfig(PretrainedConfig):
|
|
| 80 |
if isinstance(value, str):
|
| 81 |
value = value.lower()
|
| 82 |
setattr(self, attr, value)
|
| 83 |
-
|
| 84 |
-
def __repr__(self) -> str:
|
| 85 |
-
return str(self.to_json_string())
|
| 86 |
-
|
| 87 |
-
def to_dict(self) -> dict:
|
| 88 |
-
"""Serializes this instance to a Python dictionary."""
|
| 89 |
-
output: dict
|
| 90 |
-
|
| 91 |
-
output = copy.deepcopy(self.__dict__)
|
| 92 |
-
return output
|
| 93 |
-
|
| 94 |
-
def to_json_string(self) -> str:
|
| 95 |
-
"""Serializes this instance to a JSON string."""
|
| 96 |
-
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
|
| 97 |
-
|
| 98 |
-
def to_json_file(self, json_file_path: Path | str) -> None:
|
| 99 |
-
"""Save this instance to a json file."""
|
| 100 |
-
if isinstance(json_file_path, str):
|
| 101 |
-
json_file_path: Path = Path(json_file_path)
|
| 102 |
-
with json_file_path.open("w", encoding='utf-8') as writer:
|
| 103 |
-
writer.write(self.to_json_string())
|
| 104 |
-
|
| 105 |
-
@classmethod
|
| 106 |
-
def create_base_config(cls, json_file_path: Path | str | None = None) -> GptBertConfig:
|
| 107 |
-
config: GptBertConfig
|
| 108 |
-
|
| 109 |
-
config = GptBertConfig()
|
| 110 |
-
if json_file_path is not None:
|
| 111 |
-
config.to_json_file(json_file_path)
|
| 112 |
-
|
| 113 |
-
return config
|
|
|
|
| 80 |
if isinstance(value, str):
|
| 81 |
value = value.lower()
|
| 82 |
setattr(self, attr, value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|