aapot
commited on
Commit
•
0f7f86a
1
Parent(s):
6d2b0f2
added pytorch model
Browse files- config.json +2 -0
- flax_model.msgpack +2 -2
- flax_model_to_pytorch.py +3 -1
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
config.json
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
{
|
|
|
2 |
"architectures": [
|
3 |
"RobertaForMaskedLM"
|
4 |
],
|
@@ -18,6 +19,7 @@
|
|
18 |
"num_hidden_layers": 24,
|
19 |
"pad_token_id": 1,
|
20 |
"position_embedding_type": "absolute",
|
|
|
21 |
"transformers_version": "4.9.0.dev0",
|
22 |
"type_vocab_size": 1,
|
23 |
"use_cache": true,
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "./",
|
3 |
"architectures": [
|
4 |
"RobertaForMaskedLM"
|
5 |
],
|
|
|
19 |
"num_hidden_layers": 24,
|
20 |
"pad_token_id": 1,
|
21 |
"position_embedding_type": "absolute",
|
22 |
+
"torch_dtype": "float32",
|
23 |
"transformers_version": "4.9.0.dev0",
|
24 |
"type_vocab_size": 1,
|
25 |
"use_cache": true,
|
flax_model.msgpack
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:daa01e29425ff0d35c30005a143e3832295136dd11c19885af9a8778bcede272
|
3 |
+
size 1421662309
|
flax_model_to_pytorch.py
CHANGED
@@ -4,6 +4,8 @@ import numpy as np
|
|
4 |
import jax
|
5 |
import jax.numpy as jnp
|
6 |
|
|
|
|
|
7 |
MODEL_PATH = "./"
|
8 |
|
9 |
model = FlaxRobertaForMaskedLM.from_pretrained(MODEL_PATH)
|
@@ -14,7 +16,7 @@ def to_f32(t):
|
|
14 |
model.params = to_f32(model.params)
|
15 |
model.save_pretrained(MODEL_PATH)
|
16 |
|
17 |
-
pt_model = RobertaForMaskedLM.from_pretrained(MODEL_PATH, from_flax=True)
|
18 |
|
19 |
input_ids = np.asarray(2 * [128 * [0]], dtype=np.int32)
|
20 |
input_ids_pt = torch.tensor(input_ids)
|
|
|
4 |
import jax
|
5 |
import jax.numpy as jnp
|
6 |
|
7 |
+
jax.config.update('jax_platform_name', 'cpu')
|
8 |
+
|
9 |
MODEL_PATH = "./"
|
10 |
|
11 |
model = FlaxRobertaForMaskedLM.from_pretrained(MODEL_PATH)
|
|
|
16 |
model.params = to_f32(model.params)
|
17 |
model.save_pretrained(MODEL_PATH)
|
18 |
|
19 |
+
pt_model = RobertaForMaskedLM.from_pretrained(MODEL_PATH, from_flax=True).to('cpu')
|
20 |
|
21 |
input_ids = np.asarray(2 * [128 * [0]], dtype=np.int32)
|
22 |
input_ids_pt = torch.tensor(input_ids)
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:853b48bbe067f4afcee874db6e355750e366b46c41549eac7a61e7d54046c6aa
|
3 |
+
size 1421780139
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false}}
|
tokenizer.json
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"unk_token": "<unk>", "bos_token": "<s>", "eos_token": "</s>", "add_prefix_space": false, "errors": "replace", "sep_token": "</s>", "cls_token": "<s>", "pad_token": "<pad>", "mask_token": "<mask>", "special_tokens_map_file": null, "name_or_path": "./", "tokenizer_class": "RobertaTokenizer"}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|