Upload transformers_example_mt.ipynb
Browse files
transformers_example_mt.ipynb
CHANGED
|
@@ -29,27 +29,18 @@
|
|
| 29 |
"execution_count": 2,
|
| 30 |
"id": "ba9ec6c7",
|
| 31 |
"metadata": {},
|
| 32 |
-
"outputs": [
|
| 33 |
-
{
|
| 34 |
-
"name": "stderr",
|
| 35 |
-
"output_type": "stream",
|
| 36 |
-
"text": [
|
| 37 |
-
"Some weights of BertModel were not initialized from the model checkpoint at mdbr-leaf-mt and are newly initialized: ['pooler.dense.bias', 'pooler.dense.weight']\n",
|
| 38 |
-
"You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
|
| 39 |
-
]
|
| 40 |
-
}
|
| 41 |
-
],
|
| 42 |
"source": [
|
| 43 |
"# Then load it\n",
|
| 44 |
"MODEL = \"mdbr-leaf-mt\"\n",
|
| 45 |
"\n",
|
| 46 |
"tokenizer = AutoTokenizer.from_pretrained(MODEL)\n",
|
| 47 |
-
"model = AutoModel.from_pretrained(MODEL)"
|
| 48 |
]
|
| 49 |
},
|
| 50 |
{
|
| 51 |
"cell_type": "code",
|
| 52 |
-
"execution_count":
|
| 53 |
"id": "ebaf1a76",
|
| 54 |
"metadata": {},
|
| 55 |
"outputs": [],
|
|
@@ -62,7 +53,7 @@
|
|
| 62 |
},
|
| 63 |
{
|
| 64 |
"cell_type": "code",
|
| 65 |
-
"execution_count":
|
| 66 |
"id": "03ffcd9c",
|
| 67 |
"metadata": {},
|
| 68 |
"outputs": [
|
|
@@ -130,8 +121,8 @@
|
|
| 130 |
"print(f\"Similarities:\\n{similarities}\")\n",
|
| 131 |
"\n",
|
| 132 |
"# Similarities:\n",
|
| 133 |
-
"#
|
| 134 |
-
"#
|
| 135 |
]
|
| 136 |
},
|
| 137 |
{
|
|
|
|
| 29 |
"execution_count": 2,
|
| 30 |
"id": "ba9ec6c7",
|
| 31 |
"metadata": {},
|
| 32 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
"source": [
|
| 34 |
"# Then load it\n",
|
| 35 |
"MODEL = \"mdbr-leaf-mt\"\n",
|
| 36 |
"\n",
|
| 37 |
"tokenizer = AutoTokenizer.from_pretrained(MODEL)\n",
|
| 38 |
+
"model = AutoModel.from_pretrained(MODEL, add_pooling_layer=False)"
|
| 39 |
]
|
| 40 |
},
|
| 41 |
{
|
| 42 |
"cell_type": "code",
|
| 43 |
+
"execution_count": 3,
|
| 44 |
"id": "ebaf1a76",
|
| 45 |
"metadata": {},
|
| 46 |
"outputs": [],
|
|
|
|
| 53 |
},
|
| 54 |
{
|
| 55 |
"cell_type": "code",
|
| 56 |
+
"execution_count": null,
|
| 57 |
"id": "03ffcd9c",
|
| 58 |
"metadata": {},
|
| 59 |
"outputs": [
|
|
|
|
| 121 |
"print(f\"Similarities:\\n{similarities}\")\n",
|
| 122 |
"\n",
|
| 123 |
"# Similarities:\n",
|
| 124 |
+
"# tensor([[0.9063, 0.7287],\n",
|
| 125 |
+
"# [0.6725, 0.8287]])"
|
| 126 |
]
|
| 127 |
},
|
| 128 |
{
|