suayptalha
commited on
Update configuration_minGRULM.py
Browse files- configuration_minGRULM.py +19 -0
configuration_minGRULM.py
CHANGED
@@ -26,3 +26,22 @@ class MinGRULMConfig(PretrainedConfig):
|
|
26 |
self.pad_vocab_size_multiple = pad_vocab_size_multiple
|
27 |
self.initializer_range = initializer_range
|
28 |
super().__init__(**kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
self.pad_vocab_size_multiple = pad_vocab_size_multiple
|
27 |
self.initializer_range = initializer_range
|
28 |
super().__init__(**kwargs)
|
29 |
+
|
30 |
+
def state_dict(self):
|
31 |
+
"""
|
32 |
+
Custom state_dict function to return the model's state dict.
|
33 |
+
This includes the wrapped model and any extra components like the language model head.
|
34 |
+
"""
|
35 |
+
state_dict = {}
|
36 |
+
|
37 |
+
# Add min_gru_model's state_dict
|
38 |
+
state_dict['model'] = self.model.min_gru_model.state_dict()
|
39 |
+
|
40 |
+
# Add lm_head's state_dict
|
41 |
+
state_dict['lm_head'] = self.lm_head.state_dict()
|
42 |
+
|
43 |
+
# Add config as a dictionary
|
44 |
+
state_dict['config'] = self.config.__dict__
|
45 |
+
|
46 |
+
return state_dict
|
47 |
+
|