Created
June 11, 2021 17:06
-
-
Save jamescalam/1354187639957947f7a183fc331e93a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from tokenizers.processors import BertProcessing\n", | |
"\n", | |
"# set [CLS] and [SEP] to be added to start-end of sequences\n", | |
"tokenizer._tokenizer.post_processor = BertProcessing(\n", | |
" ('[SEP]', tokenizer.token_to_id('[SEP]')),\n", | |
" ('[CLS]', tokenizer.token_to_id('[CLS]'))\n", | |
")" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "ML", | |
"language": "python", | |
"name": "ml" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.8.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment