Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,28 @@
|
|
1 |
---
|
2 |
datasets:
|
3 |
- wikitext-2-v1
|
|
|
4 |
language:
|
5 |
- en
|
6 |
library_name: transformers
|
7 |
metrics: crossentropy
|
8 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
datasets:
|
3 |
- wikitext-2-v1
|
4 |
+
- yizhongw/self_instruct
|
5 |
language:
|
6 |
- en
|
7 |
library_name: transformers
|
8 |
metrics: crossentropy
|
9 |
+
---
|
10 |
+
|
11 |
+
1. download the pth file
|
12 |
+
2. load the state dict
|
13 |
+
|
14 |
+
```python
|
15 |
+
from transformers import T5Tokenizer
|
16 |
+
from transformers.models.llama import LlamaConfig
|
17 |
+
|
18 |
+
config = LlamaConfig.from_pretrained(f"hpcaitech/openmoe-base")
|
19 |
+
model = OpenMoeForCausalLM(config)
|
20 |
+
ckpt = torch.load("openmoe_base_yizhongw_super_natural_instruction_generation.pth")
|
21 |
+
state_dict = {}
|
22 |
+
for key, value in ckpt.items():
|
23 |
+
if key.startswith("module."):
|
24 |
+
state_dict[key[7:]] = value
|
25 |
+
else:
|
26 |
+
state_dict[key] = value
|
27 |
+
model.load_state_dict(state_dict)
|
28 |
+
```
|