Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
huseinzol05 committed Nov 30, 2021
1 parent f052dbc commit 6e47a47
Show file tree
Hide file tree
Showing 22 changed files with 990 additions and 581 deletions.
168 changes: 83 additions & 85 deletions docs/load-emotion.ipynb

Large diffs are not rendered by default.

136 changes: 95 additions & 41 deletions docs/load-entities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 4.79 s, sys: 950 ms, total: 5.74 s\n",
"Wall time: 6.79 s\n"
"CPU times: user 6.33 s, sys: 1.4 s, total: 7.73 s\n",
"Wall time: 9.25 s\n"
]
}
],
Expand Down Expand Up @@ -349,7 +349,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -436,29 +436,49 @@
" <td>0.97575</td>\n",
" <td>0.98337</td>\n",
" </tr>\n",
" <tr>\n",
" <th>fastformer</th>\n",
" <td>446.6</td>\n",
" <td>113.00</td>\n",
" <td>0.95031</td>\n",
" <td>0.94018</td>\n",
" <td>0.94498</td>\n",
" </tr>\n",
" <tr>\n",
" <th>tiny-fastformer</th>\n",
" <td>77.3</td>\n",
" <td>19.70</td>\n",
" <td>0.93574</td>\n",
" <td>0.89979</td>\n",
" <td>0.91640</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Size (MB) Quantized Size (MB) macro precision macro recall \\\n",
"bert 425.4 111.00 0.99291 0.97864 \n",
"tiny-bert 57.7 15.40 0.98151 0.94754 \n",
"albert 48.6 12.80 0.98026 0.95332 \n",
"tiny-albert 22.4 5.98 0.96100 0.90363 \n",
"xlnet 446.6 118.00 0.99344 0.98154 \n",
"alxlnet 46.8 13.30 0.99215 0.97575 \n",
" Size (MB) Quantized Size (MB) macro precision \\\n",
"bert 425.4 111.00 0.99291 \n",
"tiny-bert 57.7 15.40 0.98151 \n",
"albert 48.6 12.80 0.98026 \n",
"tiny-albert 22.4 5.98 0.96100 \n",
"xlnet 446.6 118.00 0.99344 \n",
"alxlnet 46.8 13.30 0.99215 \n",
"fastformer 446.6 113.00 0.95031 \n",
"tiny-fastformer 77.3 19.70 0.93574 \n",
"\n",
" macro f1-score \n",
"bert 0.98537 \n",
"tiny-bert 0.96134 \n",
"albert 0.96492 \n",
"tiny-albert 0.92374 \n",
"xlnet 0.98725 \n",
"alxlnet 0.98337 "
" macro recall macro f1-score \n",
"bert 0.97864 0.98537 \n",
"tiny-bert 0.94754 0.96134 \n",
"albert 0.95332 0.96492 \n",
"tiny-albert 0.90363 0.92374 \n",
"xlnet 0.98154 0.98725 \n",
"alxlnet 0.97575 0.98337 \n",
"fastformer 0.94018 0.94498 \n",
"tiny-fastformer 0.89979 0.91640 "
]
},
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -483,7 +503,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {
"scrolled": true
},
Expand Down Expand Up @@ -572,29 +592,49 @@
" <td>0.92942</td>\n",
" <td>0.93047</td>\n",
" </tr>\n",
" <tr>\n",
" <th>fastformer</th>\n",
" <td>446.6</td>\n",
" <td>113.00</td>\n",
" <td>0.77486</td>\n",
" <td>0.67007</td>\n",
" <td>0.69065</td>\n",
" </tr>\n",
" <tr>\n",
" <th>tiny-fastformer</th>\n",
" <td>77.3</td>\n",
" <td>19.70</td>\n",
" <td>0.68351</td>\n",
" <td>0.60469</td>\n",
" <td>0.61678</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Size (MB) Quantized Size (MB) macro precision macro recall \\\n",
"bert 425.4 111.00 0.94460 0.93244 \n",
"tiny-bert 57.7 15.40 0.91908 0.91635 \n",
"albert 48.6 12.80 0.93010 0.92341 \n",
"tiny-albert 22.4 5.98 0.90298 0.88251 \n",
"xlnet 446.6 118.00 0.93814 0.95021 \n",
"alxlnet 46.8 13.30 0.93244 0.92942 \n",
" Size (MB) Quantized Size (MB) macro precision \\\n",
"bert 425.4 111.00 0.94460 \n",
"tiny-bert 57.7 15.40 0.91908 \n",
"albert 48.6 12.80 0.93010 \n",
"tiny-albert 22.4 5.98 0.90298 \n",
"xlnet 446.6 118.00 0.93814 \n",
"alxlnet 46.8 13.30 0.93244 \n",
"fastformer 446.6 113.00 0.77486 \n",
"tiny-fastformer 77.3 19.70 0.68351 \n",
"\n",
" macro f1-score \n",
"bert 0.93822 \n",
"tiny-bert 0.91704 \n",
"albert 0.92636 \n",
"tiny-albert 0.89145 \n",
"xlnet 0.94388 \n",
"alxlnet 0.93047 "
" macro recall macro f1-score \n",
"bert 0.93244 0.93822 \n",
"tiny-bert 0.91635 0.91704 \n",
"albert 0.92341 0.92636 \n",
"tiny-albert 0.88251 0.89145 \n",
"xlnet 0.95021 0.94388 \n",
"alxlnet 0.92942 0.93047 \n",
"fastformer 0.67007 0.69065 \n",
"tiny-fastformer 0.60469 0.61678 "
]
},
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -629,7 +669,7 @@
"```python\n",
"def transformer(model: str = 'xlnet', quantized: bool = False, **kwargs):\n",
" \"\"\"\n",
" Load Transformer Entity Tagging model, transfer learning Transformer + CRF.\n",
" Load Transformer Entity Tagging model trained on Malaya Entity, transfer learning Transformer + CRF.\n",
"\n",
" Parameters\n",
" ----------\n",
Expand All @@ -642,14 +682,21 @@
" * ``'tiny-albert'`` - Google ALBERT TINY parameters.\n",
" * ``'xlnet'`` - Google XLNET BASE parameters.\n",
" * ``'alxlnet'`` - Malaya ALXLNET BASE parameters.\n",
" \n",
" * ``'fastformer'`` - FastFormer BASE parameters.\n",
" * ``'tiny-fastformer'`` - FastFormer TINY parameters.\n",
"\n",
" quantized : bool, optional (default=False)\n",
" if True, will load 8-bit quantized model. \n",
" if True, will load 8-bit quantized model.\n",
" Quantized model not necessary faster, totally depends on the machine.\n",
"\n",
" Returns\n",
" -------\n",
" result : malaya.supervised.tag.transformer function\n",
" result: model\n",
" List of model classes:\n",
"\n",
" * if `bert` in model, will return `malaya.model.bert.TaggingBERT`.\n",
" * if `xlnet` in model, will return `malaya.model.xlnet.TaggingXLNET`.\n",
" * if `fastformer` in model, will return `malaya.model.fastformer.TaggingFastFormer`.\n",
" \"\"\"\n",
"```"
]
Expand Down Expand Up @@ -1419,14 +1466,21 @@
" * ``'tiny-albert'`` - Google ALBERT TINY parameters.\n",
" * ``'xlnet'`` - Google XLNET BASE parameters.\n",
" * ``'alxlnet'`` - Malaya ALXLNET BASE parameters.\n",
" \n",
" * ``'fastformer'`` - FastFormer BASE parameters.\n",
" * ``'tiny-fastformer'`` - FastFormer TINY parameters.\n",
"\n",
" quantized : bool, optional (default=False)\n",
" if True, will load 8-bit quantized model. \n",
" if True, will load 8-bit quantized model.\n",
" Quantized model not necessary faster, totally depends on the machine.\n",
"\n",
" Returns\n",
" -------\n",
" result : malaya.supervised.tag.transformer function\n",
" result: model\n",
" List of model classes:\n",
"\n",
" * if `bert` in model, will return `malaya.model.bert.TaggingBERT`.\n",
" * if `xlnet` in model, will return `malaya.model.xlnet.TaggingXLNET`.\n",
" * if `fastformer` in model, will return `malaya.model.fastformer.TaggingFastFormer`.\n",
" \"\"\"\n",
"```"
]
Expand Down
74 changes: 50 additions & 24 deletions docs/load-relevancy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 4.19 s, sys: 554 ms, total: 4.74 s\n",
"Wall time: 3.84 s\n"
"CPU times: user 6.06 s, sys: 1.31 s, total: 7.37 s\n",
"Wall time: 8.62 s\n"
]
}
],
Expand Down Expand Up @@ -80,7 +80,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -192,33 +192,55 @@
" <td>0.86176</td>\n",
" <td>1024.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>fastformer</th>\n",
" <td>458.0</td>\n",
" <td>116.00</td>\n",
" <td>0.92387</td>\n",
" <td>0.91064</td>\n",
" <td>0.91616</td>\n",
" <td>2048.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>tiny-fastformer</th>\n",
" <td>77.3</td>\n",
" <td>19.70</td>\n",
" <td>0.85655</td>\n",
" <td>0.86337</td>\n",
" <td>0.85925</td>\n",
" <td>2048.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Size (MB) Quantized Size (MB) macro precision macro recall \\\n",
"bert 425.6 111.00 0.89320 0.89195 \n",
"tiny-bert 57.4 15.40 0.87179 0.86324 \n",
"albert 48.6 12.80 0.89798 0.86008 \n",
"tiny-albert 22.4 5.98 0.82157 0.83410 \n",
"xlnet 446.6 118.00 0.92707 0.92103 \n",
"alxlnet 46.8 13.30 0.91135 0.90446 \n",
"bigbird 458.0 116.00 0.88093 0.86832 \n",
"tiny-bigbird 65.0 16.90 0.86558 0.85871 \n",
" Size (MB) Quantized Size (MB) macro precision \\\n",
"bert 425.6 111.00 0.89320 \n",
"tiny-bert 57.4 15.40 0.87179 \n",
"albert 48.6 12.80 0.89798 \n",
"tiny-albert 22.4 5.98 0.82157 \n",
"xlnet 446.6 118.00 0.92707 \n",
"alxlnet 46.8 13.30 0.91135 \n",
"bigbird 458.0 116.00 0.88093 \n",
"tiny-bigbird 65.0 16.90 0.86558 \n",
"fastformer 458.0 116.00 0.92387 \n",
"tiny-fastformer 77.3 19.70 0.85655 \n",
"\n",
" macro f1-score max length \n",
"bert 0.89256 512.0 \n",
"tiny-bert 0.86695 512.0 \n",
"albert 0.87209 512.0 \n",
"tiny-albert 0.82416 512.0 \n",
"xlnet 0.92381 512.0 \n",
"alxlnet 0.90758 512.0 \n",
"bigbird 0.87352 1024.0 \n",
"tiny-bigbird 0.86176 1024.0 "
" macro recall macro f1-score max length \n",
"bert 0.89195 0.89256 512.0 \n",
"tiny-bert 0.86324 0.86695 512.0 \n",
"albert 0.86008 0.87209 512.0 \n",
"tiny-albert 0.83410 0.82416 512.0 \n",
"xlnet 0.92103 0.92381 512.0 \n",
"alxlnet 0.90446 0.90758 512.0 \n",
"bigbird 0.86832 0.87352 1024.0 \n",
"tiny-bigbird 0.85871 0.86176 1024.0 \n",
"fastformer 0.91064 0.91616 2048.0 \n",
"tiny-fastformer 0.86337 0.85925 2048.0 "
]
},
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -260,18 +282,22 @@
" * ``'alxlnet'`` - Malaya ALXLNET BASE parameters.\n",
" * ``'bigbird'`` - Google BigBird BASE parameters.\n",
" * ``'tiny-bigbird'`` - Malaya BigBird BASE parameters.\n",
" * ``'fastformer'`` - FastFormer BASE parameters.\n",
" * ``'tiny-fastformer'`` - FastFormer TINY parameters.\n",
"\n",
" quantized : bool, optional (default=False)\n",
" if True, will load 8-bit quantized model. \n",
" if True, will load 8-bit quantized model.\n",
" Quantized model not necessary faster, totally depends on the machine.\n",
"\n",
" Returns\n",
" -------\n",
" result: model\n",
" List of model classes:\n",
" \n",
"\n",
" * if `bert` in model, will return `malaya.model.bert.MulticlassBERT`.\n",
" * if `xlnet` in model, will return `malaya.model.xlnet.MulticlassXLNET`.\n",
" * if `bigbird` in model, will return `malaya.model.xlnet.MulticlassBigBird`.\n",
" * if `fastformer` in model, will return `malaya.model.fastformer.MulticlassFastFormer`.\n",
" \"\"\"\n",
"```"
]
Expand Down
Loading

0 comments on commit 6e47a47

Please sign in to comment.