File size: 3,237 Bytes
22f1525 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from rich import print as rprint"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"content = json.load(open('/Users/dhruvanand/Downloads/tokenizer.json'))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"131"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(content[\"added_tokens\"])"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">dict_keys</span><span style=\"font-weight: bold\">([</span><span style=\"color: #008000; text-decoration-color: #008000\">'type'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'dropout'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'unk_token'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'continuing_subword_prefix'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'end_of_word_suffix'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'fuse_unk'</span>, \n",
"<span style=\"color: #008000; text-decoration-color: #008000\">'byte_fallback'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'ignore_merges'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'vocab'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'merges'</span><span style=\"font-weight: bold\">])</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;35mdict_keys\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'type'\u001b[0m, \u001b[32m'dropout'\u001b[0m, \u001b[32m'unk_token'\u001b[0m, \u001b[32m'continuing_subword_prefix'\u001b[0m, \u001b[32m'end_of_word_suffix'\u001b[0m, \u001b[32m'fuse_unk'\u001b[0m, \n",
"\u001b[32m'byte_fallback'\u001b[0m, \u001b[32m'ignore_merges'\u001b[0m, \u001b[32m'vocab'\u001b[0m, \u001b[32m'merges'\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"rprint(content[\"model\"].keys())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|