Upload config.py with huggingface_hub
Browse files
config.py
CHANGED
|
@@ -225,14 +225,25 @@ class HATArchitectureConfig(PretrainedConfig):
|
|
| 225 |
decoder_config = DecoderHATModelConfig.from_dict(decoder_dict) if decoder_dict else None
|
| 226 |
special_token_dict = config_dict.pop("special_token_dict", {"<|eot_id|>": 192})
|
| 227 |
max_word_size = config_dict.pop("max_word_size", 100)
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
|
| 237 |
def to_dict(self):
|
| 238 |
config_dict = {}
|
|
|
|
| 225 |
decoder_config = DecoderHATModelConfig.from_dict(decoder_dict) if decoder_dict else None
|
| 226 |
special_token_dict = config_dict.pop("special_token_dict", {"<|eot_id|>": 192})
|
| 227 |
max_word_size = config_dict.pop("max_word_size", 100)
|
| 228 |
+
return_unused_kwargs = config_dict.pop("return_unused_kwargs", False)
|
| 229 |
+
if return_unused_kwargs:
|
| 230 |
+
return cls(
|
| 231 |
+
encoder_config=encoder_config,
|
| 232 |
+
backbone_config=backbone_config,
|
| 233 |
+
decoder_config=decoder_config,
|
| 234 |
+
special_token_dict=special_token_dict,
|
| 235 |
+
max_word_size=max_word_size,
|
| 236 |
+
**config_dict,
|
| 237 |
+
), {}
|
| 238 |
+
else:
|
| 239 |
+
return cls(
|
| 240 |
+
encoder_config=encoder_config,
|
| 241 |
+
backbone_config=backbone_config,
|
| 242 |
+
decoder_config=decoder_config,
|
| 243 |
+
special_token_dict=special_token_dict,
|
| 244 |
+
max_word_size=max_word_size,
|
| 245 |
+
**config_dict,
|
| 246 |
+
)
|
| 247 |
|
| 248 |
def to_dict(self):
|
| 249 |
config_dict = {}
|