rvo commited on
Commit
05cae9a
·
verified ·
1 Parent(s): c342f94

Upload transformers_example_mt.ipynb

Browse files
Files changed (1) hide show
  1. transformers_example_mt.ipynb +6 -15
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": null,
53
  "id": "ebaf1a76",
54
  "metadata": {},
55
  "outputs": [],
@@ -62,7 +53,7 @@
62
  },
63
  {
64
  "cell_type": "code",
65
- "execution_count": 21,
66
  "id": "03ffcd9c",
67
  "metadata": {},
68
  "outputs": [
@@ -130,8 +121,8 @@
130
  "print(f\"Similarities:\\n{similarities}\")\n",
131
  "\n",
132
  "# Similarities:\n",
133
- "# tensor([[0.6857, 0.4598],\n",
134
- "# [0.4238, 0.5723]])"
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
  {