Commit ·
6c2fcf7
1
Parent(s): 8777cb2
Upload BERT_Arch
Browse files
init.py
CHANGED
|
@@ -60,20 +60,22 @@ class BERT_Arch(BertPreTrainedModel):
|
|
| 60 |
return x
|
| 61 |
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
model
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
#
|
| 75 |
-
#
|
| 76 |
-
#
|
| 77 |
-
# #
|
| 78 |
-
# # model
|
| 79 |
-
# #
|
|
|
|
|
|
|
|
|
| 60 |
return x
|
| 61 |
|
| 62 |
|
| 63 |
+
if __name__ == "__main__":
|
| 64 |
+
|
| 65 |
+
PragFormerConfig.register_for_auto_class()
|
| 66 |
+
BERT_Arch.register_for_auto_class("AutoModel")
|
| 67 |
+
config = PragFormerConfig.from_pretrained('./PragFormer')
|
| 68 |
+
model = BERT_Arch(config)
|
| 69 |
+
pretrained_model = BERT_Arch.from_pretrained("./PragFormer")
|
| 70 |
+
model.load_state_dict(pretrained_model.state_dict())
|
| 71 |
+
model.push_to_hub("PragFormer")
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
# AutoConfig.register("pragformer", PragFormerConfig)
|
| 75 |
+
# AutoModel.register(PragFormerConfig, BERT_Arch)
|
| 76 |
+
# model.push_to_hub("PragFormer")
|
| 77 |
+
# # config = PragFormerConfig.from_pretrained('./PragFormer')
|
| 78 |
+
# # model = BERT_Arch(config)
|
| 79 |
+
# # pretrained_model = BERT_Arch.from_pretrained("./PragFormer")
|
| 80 |
+
# # model.load_state_dict(pretrained_model.state_dict())
|
| 81 |
+
# # model.push_to_hub("PragFormer")
|