Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"టోకనైజర్లు","local":"tokenizers","sections":[{"title":"పదాల ఆధారంగా","local":"word-based","sections":[],"depth":2},{"title":"అక్షరాల ఆధారంగా","local":"character-based","sections":[],"depth":2},{"title":"సబ్వర్డ్ టోకనైజేషన్","local":"subword-tokenization","sections":[{"title":"ఇంకా చాలా!","local":"and-more","sections":[],"depth":3}],"depth":2},{"title":"లోడ్ చేయడం మరియు సేవ్ చేయడం","local":"loading-and-saving","sections":[],"depth":2},{"title":"Encoding","local":"encoding","sections":[{"title":"Tokenization","local":"tokenization","sections":[],"depth":3},{"title":"Tokens నుండి input IDs వరకు","local":"from-tokens-to-input-ids","sections":[],"depth":3}],"depth":2},{"title":"Decoding","local":"decoding","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/course/pr_1149/te/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/entry/start.eee4c1e0.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/scheduler.cc52f4b9.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/singletons.69904a63.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/index.5033808a.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/paths.e8418a83.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/entry/app.0f38558a.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/preload-helper.ae923e55.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/index.bd400c31.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/nodes/0.bd814f6d.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/nodes/17.97d2ff01.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/Tip.272e6bd8.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.25fe1ea6.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/Youtube.4afc5ee9.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/CodeBlock.1794e33c.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/CourseFloatingBanner.6f780cc4.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1149/te/_app/immutable/chunks/FrameworkSwitchCourse.e8e44fa0.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"టోకనైజర్లు","local":"tokenizers","sections":[{"title":"పదాల ఆధారంగా","local":"word-based","sections":[],"depth":2},{"title":"అక్షరాల ఆధారంగా","local":"character-based","sections":[],"depth":2},{"title":"సబ్వర్డ్ టోకనైజేషన్","local":"subword-tokenization","sections":[{"title":"ఇంకా చాలా!","local":"and-more","sections":[],"depth":3}],"depth":2},{"title":"లోడ్ చేయడం మరియు సేవ్ చేయడం","local":"loading-and-saving","sections":[],"depth":2},{"title":"Encoding","local":"encoding","sections":[{"title":"Tokenization","local":"tokenization","sections":[],"depth":3},{"title":"Tokens నుండి input IDs వరకు","local":"from-tokens-to-input-ids","sections":[],"depth":3}],"depth":2},{"title":"Decoding","local":"decoding","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <div class="bg-white leading-none border border-gray-100 rounded-lg flex p-0.5 w-56 text-sm mb-4"><a class="flex justify-center flex-1 py-1.5 px-2.5 focus:outline-none !no-underline rounded-l bg-red-50 dark:bg-transparent text-red-600" href="?fw=pt"><svg class="mr-1.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><defs><clipPath id="a"><rect x="3.05" y="0.5" width="25.73" height="31" fill="none"></rect></clipPath></defs><g clip-path="url(#a)"><path d="M24.94,9.51a12.81,12.81,0,0,1,0,18.16,12.68,12.68,0,0,1-18,0,12.81,12.81,0,0,1,0-18.16l9-9V5l-.84.83-6,6a9.58,9.58,0,1,0,13.55,0ZM20.44,9a1.68,1.68,0,1,1,1.67-1.67A1.68,1.68,0,0,1,20.44,9Z" fill="#ee4c2c"></path></g></svg> Pytorch </a><a class="flex justify-center flex-1 py-1.5 px-2.5 focus:outline-none !no-underline rounded-r text-gray-500 filter grayscale" href="?fw=tf"><svg class="mr-1.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="0.94em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 274"><path d="M145.726 42.065v42.07l72.861 42.07v-42.07l-72.86-42.07zM0 84.135v42.07l36.43 21.03V105.17L0 84.135zm109.291 21.035l-36.43 21.034v126.2l36.43 21.035v-84.135l36.435 21.035v-42.07l-36.435-21.034V105.17z" fill="#E55B2D"></path><path d="M145.726 42.065L36.43 105.17v42.065l72.861-42.065v42.065l36.435-21.03v-84.14zM255.022 63.1l-36.435 21.035v42.07l36.435-21.035V63.1zm-72.865 84.135l-36.43 21.035v42.07l36.43-21.036v-42.07zm-36.43 63.104l-36.436-21.035v84.135l36.435-21.035V210.34z" fill="#ED8E24"></path><path d="M145.726 0L0 84.135l36.43 21.035l109.296-63.105l72.861 42.07L255.022 63.1L145.726 0zm0 126.204l-36.435 21.03l36.435 21.036l36.43-21.035l-36.43-21.03z" fill="#F8BF3C"></path></svg> TensorFlow </a></div> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 max-sm:gap-0.5 h-6 max-sm:h-5 px-2 max-sm:px-1.5 text-[11px] max-sm:text-[9px] font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0"><svg class="w-3 h-3 max-sm:w-2.5 max-sm:h-2.5" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-6 max-sm:h-5 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible w-3 h-3 max-sm:w-2.5 max-sm:h-2.5 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></button></div> </div> <h1 class="relative group"><a id="tokenizers" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#tokenizers"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>టోకనైజర్లు</span></h1> <div class="flex space-x-1 absolute z-10 right-0 top-0" style=""><a href="https://discuss.huggingface.co/t/chapter-2-questions" target="_blank"><img alt="Ask a Question" class="!m-0" src="https://img.shields.io/badge/Ask%20a%20question-ffcb4c.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgLTEgMTA0IDEwNiI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOiMyMzFmMjA7fS5jbHMtMntmaWxsOiNmZmY5YWU7fS5jbHMtM3tmaWxsOiMwMGFlZWY7fS5jbHMtNHtmaWxsOiMwMGE5NGY7fS5jbHMtNXtmaWxsOiNmMTVkMjI7fS5jbHMtNntmaWxsOiNlMzFiMjM7fTwvc3R5bGU+PC9kZWZzPjx0aXRsZT5EaXNjb3Vyc2VfbG9nbzwvdGl0bGU+PGcgaWQ9IkxheWVyXzIiPjxnIGlkPSJMYXllcl8zIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik01MS44NywwQzIzLjcxLDAsMCwyMi44MywwLDUxYzAsLjkxLDAsNTIuODEsMCw1Mi44MWw1MS44Ni0uMDVjMjguMTYsMCw1MS0yMy43MSw1MS01MS44N1M4MCwwLDUxLjg3LDBaIi8+PHBhdGggY2xhc3M9ImNscy0yIiBkPSJNNTIuMzcsMTkuNzRBMzEuNjIsMzEuNjIsMCwwLDAsMjQuNTgsNjYuNDFsLTUuNzIsMTguNEwzOS40LDgwLjE3YTMxLjYxLDMxLjYxLDAsMSwwLDEzLTYwLjQzWiIvPjxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTc3LjQ1LDMyLjEyYTMxLjYsMzEuNiwwLDAsMS0zOC4wNSw0OEwxOC44Niw4NC44MmwyMC45MS0yLjQ3QTMxLjYsMzEuNiwwLDAsMCw3Ny40NSwzMi4xMloiLz48cGF0aCBjbGFzcz0iY2xzLTQiIGQ9Ik03MS42MywyNi4yOUEzMS42LDMxLjYsMCwwLDEsMzguOCw3OEwxOC44Niw4NC44MiwzOS40LDgwLjE3QTMxLjYsMzEuNiwwLDAsMCw3MS42MywyNi4yOVoiLz48cGF0aCBjbGFzcz0iY2xzLTUiIGQ9Ik0yNi40Nyw2Ny4xMWEzMS42MSwzMS42MSwwLDAsMSw1MS0zNUEzMS42MSwzMS42MSwwLDAsMCwyNC41OCw2Ni40MWwtNS43MiwxOC40WiIvPjxwYXRoIGNsYXNzPSJjbHMtNiIgZD0iTTI0LjU4LDY2LjQxQTMxLjYxLDMxLjYxLDAsMCwxLDcxLjYzLDI2LjI5YTMxLjYxLDMxLjYxLDAsMCwwLTQ5LDM5LjYzbC0zLjc2LDE4LjlaIi8+PC9nPjwvZz48L3N2Zz4="></a> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/en/chapter2/section4_pt.ipynb" target="_blank"><img alt="Open In Colab" class="!m-0" src="https://colab.research.google.com/assets/colab-badge.svg"></a> <a href="https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter2/section4_pt.ipynb" target="_blank"><img alt="Open In Studio Lab" class="!m-0" src="https://studiolab.sagemaker.aws/studiolab.svg"></a></div> <iframe class="w-full xl:w-4/6 h-80" src="https://www.youtube-nocookie.com/embed/VFp38yj8h3A" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <p data-svelte-h="svelte-11xzotb">టోకనైజర్లు NLP పైప్లైన్లోని ముఖ్య భాగాల్లో ఒకటి. వీటి లక్ష్యం ఒక్కటే: టెక్స్ట్ను మోడల్ ప్రాసెస్ చేయగలిగే డేటాగా మార్చడం. మోడళ్లు సంఖ్యలతోనే పని చేయగలవు, కాబట్టి టోకనైజర్లు మన టెక్స్ట్ ఇన్పుట్లను సంఖ్యాత్మక డేటాగా మారుస్తాయి.<br> | |
| ఈ విభాగంలో, టోకనైజేషన్ పైప్లైన్లో నిజానికి ఏమి జరుగుతుందో పరిశీలిద్దాం.</p> <p data-svelte-h="svelte-1e65ell">NLP పనుల్లో సాధారణంగా ప్రాసెస్ చేయబడే డేటా raw text. ఉదాహరణకు:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->Jim Henson was <span class="hljs-selector-tag">a</span> puppeteer<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1895m8n">అయితే, మోడళ్లు సంఖ్యలను మాత్రమే ప్రాసెస్ చేయగలవు కాబట్టి, raw textను సంఖ్యలుగా మార్చే మార్గాన్ని కనుగొనాలి. అదే టోకనైజర్ చేసే పని, మరియు దీన్ని చేయడానికి అనేక పద్ధతులు ఉన్నాయి. లక్ష్యం ఏమిటంటే, మోడల్కి ఎక్కువ అర్థమయ్యే — సాధ్యమైతే, అత్యంత చిన్న — ప్రతినిధిని (representation) కనుగొనడం.</p> <p data-svelte-h="svelte-zdywxt">ఇప్పుడు కొన్ని టోకనైజేషన్ అల్గోరిథమ్ల ఉదాహరణలను చూసి, టోకనైజేషన్ గురించి మీకు ఉండొచ్చిన కొన్ని ప్రశ్నలకు సమాధానాలు కనుగొనడానికి ప్రయత్నిద్దాం.</p> <h2 class="relative group"><a id="word-based" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#word-based"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>పదాల ఆధారంగా</span></h2> <iframe class="w-full xl:w-4/6 h-80" src="https://www.youtube-nocookie.com/embed/nhJxYji1aho" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <p data-svelte-h="svelte-11v1v5y">మెదట గుర్తొచ్చే టోకనైజర్ రకం <em>word-based</em> టోకనైజర్. కొద్దిపాటి నియమాలతో సులభంగా సెటప్ చేయవచ్చు, ఉపయోగించడం కూడా తేలిక, మరియు చాలా సందర్భాల్లో బాగానే ఫలితాలు ఇస్తుంది.<br> | |
| ఉదాహరణకు, క్రింది బొమ్మలో లక్ష్యం ఏమిటంటే, raw text ను పదాలుగా విభజించి, ప్రతి పదానికి సంఖ్యాత్మక ప్రతినిధిని కనుగొనడం:</p> <div class="flex justify-center" data-svelte-h="svelte-1od1rn"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/word_based_tokenization.svg" alt="పదాల ఆధారంగా టోకనైజేషన్ చేసిన ఒక ఉదాహరణ."> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/word_based_tokenization-dark.svg" alt="పదాల ఆధారంగా టోకనైజేషన్ చేసిన ఒక ఉదాహరణ."></div> <p data-svelte-h="svelte-rrnbyi">టెక్స్ట్ను విభజించడానికి విభిన్న పద్ధతులు ఉన్నాయి. ఉదాహరణకు, Python లో <code>split()</code> ఫంక్షన్ను ఉపయోగించి, whitespace ఆధారంగా పదాలుగా విభజించవచ్చు:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->tokenized_text = <span class="hljs-string">"Jim Henson was a puppeteer"</span>.split() | |
| <span class="hljs-built_in">print</span>(tokenized_text)<!-- HTML_TAG_END --></pre></div> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->[<span class="hljs-string">'Jim'</span>, <span class="hljs-string">'Henson'</span>, <span class="hljs-string">'was'</span>, <span class="hljs-string">'a'</span>, <span class="hljs-string">'puppeteer'</span>]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-128bj3k">కొన్ని word tokenizers పంక్చుయేషన్ కోసం అదనపు నియమాలను కూడా కలిగి ఉంటాయి. ఇటువంటి టోకనైజర్తో మనకు చాలా పెద్ద “vocabulary” రావచ్చు — ఇక్కడ vocabulary అంటే మన corpus లో ఉన్న అన్ని స్వతంత్ర tokens సంఖ్య.</p> <p data-svelte-h="svelte-kxioru">ప్రతీ పదానికి ఒక ID కేటాయిస్తారు; అది 0 నుండి vocabulary పరిమాణం వరకు ఉంటుంది. మోడల్ ప్రతి పదాన్ని గుర్తించడానికి ఈ IDs ను ఉపయోగిస్తుంది.</p> <p data-svelte-h="svelte-fda8ap">ఒక భాషలోని అన్ని పదాలను word-based టోకనైజర్ ద్వారా కవర్ చేయాలంటే, ప్రతి పదానికి ఒక్కో identifier ఉండాలి; ఇది చాలా పెద్ద సంఖ్యలో tokensను ఉత్పత్తి చేస్తుంది. ఉదాహరణకు, ఆంగ్లంలో 500,000 కంటే ఎక్కువ పదాలు ఉన్నాయి, కాబట్టి ప్రతి పదాన్ని ఒక input ID కి మ్యాప్ చేయడానికి అంతటి IDs ను నిర్వహించాలి.<br> | |
| ఇదంతా కాకుండా, “dog” మరియు “dogs” లాంటి పదాలను మోడల్ మొదట్లో పూర్తిగా వేర్వేరుగా చూస్తుంది — “dog” మరియు “dogs” పరస్పర సంబంధం లేకుండా కనిపిస్తాయి. ఇదే విషయం “run” మరియు “running” వంటి ఇతర పదాలకు కూడా వర్తిస్తుంది.</p> <p data-svelte-h="svelte-1oi0yct">చివరగా, vocabulary లో లేని పదాలను సూచించడానికి ఒక ప్రత్యేక token అవసరం. దీన్ని సాధారణంగా “unknown” token అంటారు, ” [UNK] ” లేదా ”<unk>” వంటివి. టోకనైజర్ చాలా ఎక్కువ unknown tokens ఉత్పత్తి చేస్తూ ఉంటే, అది మంచిది కాదు — ఎందుకంటే అది ఆ పదానికి సరైన ప్రతినిధిని కనుగొనలేకపోయింది, మధ్యలో సమాచారం కోల్పోతున్నామన్నమాట. కాబట్టి vocabulary రూపొందించేప్పుడు లక్ష్యం ఏమిటంటే, tokenizer వీలైనంత తక్కువ పదాలను unknown token గా మార్చేలా ఉండాలి.</p> <p data-svelte-h="svelte-1clmx8z">ఇలాంటి unknown tokens సంఖ్యను తగ్గించడానికి, మనం ఒక స్థాయి లోతుగా వెళ్లి <em>character-based</em> టోకనైజర్ను ఉపయోగించవచ్చు.</p> <h2 class="relative group"><a id="character-based" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#character-based"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>అక్షరాల ఆధారంగా</span></h2> <iframe class="w-full xl:w-4/6 h-80" src="https://www.youtube-nocookie.com/embed/ssLq_EK2jLE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <p data-svelte-h="svelte-4pm7g6">Character-based టోకనైజర్లు టెక్స్ట్ను పదాల కంటే, అక్షరాలుగా విభజిస్తాయి. దీనికి రెండు ప్రధాన ప్రయోజనాలు ఉన్నాయి:</p> <ul data-svelte-h="svelte-13g7yt6"><li>vocabulary చాలా చిన్నదిగా ఉంటుంది.</li> <li>out-of-vocabulary (unknown) tokens చాలా తక్కువగా ఉంటాయి, ఎందుకంటే ప్రతి పదాన్ని అక్షరాల నుంచి నిర్మించవచ్చు.</li></ul> <p data-svelte-h="svelte-7e4fep">కానీ ఇక్కడ కూడా spaces మరియు పంక్చుయేషన్ గురించి కొన్ని ప్రశ్నలు వస్తాయి:</p> <div class="flex justify-center" data-svelte-h="svelte-1im06bx"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/character_based_tokenization.svg" alt="అక్షరాల ఆధారంగా టోకనైజేషన్ చేసిన ఒక ఉదాహరణ."> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/character_based_tokenization-dark.svg" alt="అక్షరాల ఆధారంగా టోకనైజేషన్ చేసిన ఒక ఉదాహరణ."></div> <p data-svelte-h="svelte-lsgf0t">ఈ విధానం కూడా పరిపూర్ణం కాదు. ప్రతినిధి ఇప్పుడు పదాల ఆధారంగా కాకుండా అక్షరాల ఆధారంగా ఉందని గమనించండి; సహజంగానే చూసుకుంటే, ఒక్కో అక్షరం అంత అర్థవంతం కాకపోవచ్చు, కానీ ఒక్కో పదం మాత్రం సాధారణంగా అర్థవంతంగానే ఉంటుంది.<br> | |
| అయితే ఇది కూడా భాషపై ఆధారపడి ఉంటుంది — ఉదాహరణకు, చైనీస్లో ఒక్కో అక్షరమే చాలా సమాచారం కలిగిఉంటుంది, కానీ లాటిన్ లిపి భాషల్లో అది తక్కువ.</p> <p data-svelte-h="svelte-jyvwfg">మరికొక విషయం ఏమిటంటే, ఈ విధానంతో మన మోడల్ ప్రాసెస్ చేయాల్సిన tokens సంఖ్య చాలా పెరుగుతుంది: word-based టోకనైజర్లో ఒక పదానికి ఒకే token ఉంటే, character-based టోకనైజర్లో అదే పదం సులభంగా 10 లేదా అంతకంటే ఎక్కువ tokens గా మారిపోతుంది.</p> <p data-svelte-h="svelte-1agfldf">ఇద్దరిలోనూ ఉన్న మంచితనాన్ని పొందడానికి, మూడో పద్ధతిని ఉపయోగించవచ్చు: <em>subword tokenization</em>.</p> <h2 class="relative group"><a id="subword-tokenization" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#subword-tokenization"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>సబ్వర్డ్ టోకనైజేషన్</span></h2> <iframe class="w-full xl:w-4/6 h-80" src="https://www.youtube-nocookie.com/embed/zHvTiHr506c" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <p data-svelte-h="svelte-kjplz8">Subword టోకనైజేషన్ అల్గోరిథమ్ల ప్రాథమిక సూత్రం ఏమిటంటే:<br> | |
| తరచుగా వాడే పదాలను చిన్న subwords గా విభజించకూడదు, కానీ అరుదుగా వచ్చే పదాలను అర్థవంతమైన subwords గా విభజించాలి.</p> <p data-svelte-h="svelte-46e1v8">ఉదాహరణకు, “annoyingly” అనే పదం అరుదుగా వస్తుంది, కాబట్టి దాన్ని “annoying” మరియు “ly” గా విభజించవచ్చు. ఇవి రెండూ సొంతంగా subwords గా ఎక్కువగా కనిపించే అవకాశం ఉంది, అలాగే “annoying” + “ly” కలయిక “annoyingly” అనే భావాన్ని కూడా నిలుపుతుంది.</p> <p data-svelte-h="svelte-he16mk">“Let’s do tokenization!” అనే వాక్యానికి ఒక subword టోకనైజేషన్ అల్గోరిథమ్ ఈ విధంగా టోకనైజ్ చేస్తుందనుకోండి:</p> <div class="flex justify-center" data-svelte-h="svelte-g5eb4z"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/bpe_subword.svg" alt="సబ్వర్డ్ టోకనైజేషన్ అల్గోరిథమ్ యొక్క ఒక ఉదాహరణ."> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/bpe_subword-dark.svg" alt="సబ్వర్డ్ టోకనైజేషన్ అల్గోరిథమ్ యొక్క ఒక ఉదాహరణ."></div> <p data-svelte-h="svelte-1r77ua0">ఇలాంటి subwords మంచి semantic అర్థాన్ని ఇస్తాయి. ఉదాహరణలో “tokenization” ను “token” మరియు “ization” గా విభజించారు — ఇవి రెండూ semantic meaning కలిగిన tokens, అలాగే space-efficient కూడా (పొడవైన పదాన్ని సూచించడానికి కేవలం రెండు tokens సరిపోతాయి).<br> | |
| దీంతో చిన్న vocabularies తోనే మంచి coverage పొందగలం, unknown tokens కూడా దాదాపు ఉండవు.</p> <p data-svelte-h="svelte-1qsbeze">ఈ విధానం Turkish లాంటి agglutinative భాషల్లో మరింత ఉపయోగకరంగా ఉంటుంది, ఎందుకంటే అక్కడ subwords ను కలిపి చాలా పొడవైన సమిష్టి పదాలు సులభంగా తయారు చేయవచ్చు.</p> <h3 class="relative group"><a id="and-more" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#and-more"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>ఇంకా చాలా!</span></h3> <p data-svelte-h="svelte-n5lg65">అందుబాటులో ఇంకా చాలా tokenization పద్ధతులు ఉండటం ఆశ్చర్యకరం కాదు. కొన్ని ముఖ్యమైనవి:</p> <ul data-svelte-h="svelte-te8c38"><li>Byte-level BPE — GPT-2 లో ఉపయోగించిన పద్ధతి</li> <li>WordPiece — BERT లో ఉపయోగించబడింది</li> <li>SentencePiece లేదా Unigram — కొన్ని multilingual మోడళ్లలో ఉపయోగిస్తారు</li></ul> <p data-svelte-h="svelte-13ggx20">ఇప్పటికి, టోకనైజర్లు ఎలా పనిచేస్తాయో అర్థం చేసుకుని, API తో పని చేయడానికి మీ వద్ద సరిపడిన పునాదులు ఉన్నాయి.</p> <h2 class="relative group"><a id="loading-and-saving" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#loading-and-saving"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>లోడ్ చేయడం మరియు సేవ్ చేయడం</span></h2> <p data-svelte-h="svelte-and9mz">టోకనైజర్లను లోడ్ చేయడం, సేవ్ చేయడం కూడా మోడళ్ల మాదిరిగానే సులభం. నిజానికి, ఇవి కూడా అదే రెండు పద్ధతులపై ఆధారపడి ఉంటాయి: <code>from_pretrained()</code> మరియు <code>save_pretrained()</code>.<br> | |
| ఈ పద్ధతులు టోకనైజర్ ఉపయోగించే అల్గోరిథమ్ (మోడల్ యొక్క <em>architecture</em> లాంటిది) తో పాటు దాని vocabulary (మోడల్ <em>weights</em> లాంటిది) ను కూడా లోడ్ చేయడం లేదా సేవ్ చేయడం చేస్తాయి.</p> <p data-svelte-h="svelte-19od2l7">BERT తో ప్రీట్రైన్ చేయబడిన అదే checkpoint కు సంబంధించిన BERT tokenizer ను లోడ్ చేయడం, మోడల్ లోడ్ చేయడంలా ఉంటుంది, కానీ ఇక్కడ మనం <code>BertTokenizer</code> క్లాస్ను ఉపయోగిస్తాము:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertTokenizer | |
| tokenizer = BertTokenizer.from_pretrained(<span class="hljs-string">"bert-base-cased"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1p993ay"><code>AutoModel</code> మాదిరిగానే, <code>AutoTokenizer</code> క్లాస్ కూడా checkpoint పేరును ఆధారంగా తీసుకుని, లైబ్రరీలోని సరైన tokenizer క్లాస్ను ఎంచుకుంటుంది, మరియు ఏ checkpoint తోనైనా నేరుగా ఉపయోగించవచ్చు:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer | |
| tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"bert-base-cased"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-xjbr5f">ఇప్పుడు గత విభాగంలో చూసినట్లే tokenizer ను ఉపయోగించవచ్చు:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->tokenizer(<span class="hljs-string">"Using a Transformer network is simple"</span>)<!-- HTML_TAG_END --></pre></div> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->{<span class="hljs-string">'input_ids'</span>: [<span class="hljs-number">101</span>, <span class="hljs-number">7993</span>, <span class="hljs-number">170</span>, <span class="hljs-number">11303</span>, <span class="hljs-number">1200</span>, <span class="hljs-number">2443</span>, <span class="hljs-number">1110</span>, <span class="hljs-number">3014</span>, <span class="hljs-number">102</span>], | |
| <span class="hljs-string">'token_type_ids'</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>], | |
| <span class="hljs-string">'attention_mask'</span>: [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>]}<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-4l21ns">టోకనైజర్ను సేవ్ చేయడం కూడా మోడల్ సేవ్ చేసినట్లే ఉంటుంది:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->tokenizer.save_pretrained(<span class="hljs-string">"directory_on_my_computer"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-iqtpqg"><code>token_type_ids</code> గురించి <a href="/course/chapter3">Chapter 3</a> లో మరింతగా మాట్లాడతాం, అలాగే <code>attention_mask</code> కీ గురించి కాస్త తర్వాత వివరిస్తాము.<br> | |
| ముందుగా, <code>input_ids</code> ఎలా రూపొందించబడతాయో చూద్దాం. అందుకు tokenizer లోని intermediate methods ను పరిశీలించాలి.</p> <h2 class="relative group"><a id="encoding" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#encoding"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Encoding</span></h2> <iframe class="w-full xl:w-4/6 h-80" src="https://www.youtube-nocookie.com/embed/Yffk5aydLzg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <p data-svelte-h="svelte-1sfmta8">టెక్స్ట్ను సంఖ్యలుగా మార్చే ప్రక్రియను <em>encoding</em> అంటారు. ఇది రెండు దశల్లో జరుగుతుంది: ముందుగా tokenization, తరువాత వాటిని input IDs గా మార్చడం.</p> <p data-svelte-h="svelte-op7v1f">ముందు చూశినట్లుగా, మొదటి దశలో టెక్స్ట్ను పదాలుగా (లేదా పద భాగాలుగా, punctuation చిహ్నాలుగా మొదలైనవి) విభజిస్తారు; వీటినే సాధారణంగా <em>tokens</em> అంటారు. ఈ ప్రక్రియ ఎలా జరగాలి అన్నదానికి అనేక నియమాలు ఉండవచ్చు, అందుకే మనం tokenizer ను instantiate చేయేటప్పుడు మోడల్ పేరును ఇస్తాం — మోడల్ ప్రీట్రైనింగ్ సమయంలో ఉపయోగించిన అదే నియమాలను ఇక్కడ కూడా ఉపయోగించడానికి.</p> <p data-svelte-h="svelte-x45v42">రెండవ దశలో, ఆ tokens ను సంఖ్యలుగా మార్చుతాం, తద్వారా వాటితో టెన్సర్ను నిర్మించి మోడల్కు పంపగలం. దీని కోసం tokenizer వద్ద ఒక <em>vocabulary</em> ఉంటుంది — <code>from_pretrained()</code> పద్ధతితో instantiate చేసినప్పుడు డౌన్లోడ్ అయ్యే భాగం ఇదే.<br> | |
| ఇక్కడ కూడా, మోడల్ ప్రీట్రైనింగ్ సమయంలో ఉపయోగించిన అదే vocabulary ను ఉపయోగించాలి.</p> <p data-svelte-h="svelte-1llcaez">ఈ రెండు దశలను మెరుగ్గా అర్థం చేసుకోవడానికి, వాటిని వేర్వేరుగా పరిశీలిద్దాం. గమనించాల్సిన విషయం ఏమిటంటే, ఇక్కడ మనం tokenization పైప్లైన్లోని భాగాలను విడివిడిగా చూపే కొన్ని methods ను ఉపయోగిస్తాము, intermediate ఫలితాలను చూడటానికి. కానీ ఆచరణలో, మీరు ముందున్న సెక్షన్ 2 లో చూపినట్లుగా, మీ ఇన్పుట్లపై tokenizer ను నేరుగా కాల్ చేయాల్సిందే.</p> <h3 class="relative group"><a id="tokenization" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#tokenization"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Tokenization</span></h3> <p data-svelte-h="svelte-g0l82d">టోకనైజేషన్ ప్రక్రియ tokenizer యొక్క <code>tokenize()</code> పద్ధతి ద్వారా జరుగుతుంది:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer | |
| tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"bert-base-cased"</span>) | |
| sequence = <span class="hljs-string">"Using a Transformer network is simple"</span> | |
| tokens = tokenizer.tokenize(sequence) | |
| <span class="hljs-built_in">print</span>(tokens)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1yjpgpt">ఈ పద్ధతి ఫలితంగా stringల జాబితా వస్తుంది — ఇవే tokens:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->[<span class="hljs-string">'Using'</span>, <span class="hljs-string">'a'</span>, <span class="hljs-string">'transform'</span>, <span class="hljs-string">'##er'</span>, <span class="hljs-string">'network'</span>, <span class="hljs-string">'is'</span>, <span class="hljs-string">'simple'</span>]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-d1bry2">ఈ tokenizer ఒక subword tokenizer: ఇది తన vocabularyలో ఉన్న subwords వచ్చే వరకు పదాలను చిన్న భాగాలుగా విభజిస్తుంది. ఇక్కడ <code>transformer</code> అనే పదం <code>transform</code> మరియు <code>##er</code> అనే రెండు tokens గా విభజించబడింది.</p> <h3 class="relative group"><a id="from-tokens-to-input-ids" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#from-tokens-to-input-ids"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Tokens నుండి input IDs వరకు</span></h3> <p data-svelte-h="svelte-1yejtcm">Tokens ను input IDs గా మార్చడం tokenizer లోని <code>convert_tokens_to_ids()</code> పద్ధతి ద్వారా జరుగుతుంది:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->ids = tokenizer.convert_tokens_to_ids(tokens) | |
| <span class="hljs-built_in">print</span>(ids)<!-- HTML_TAG_END --></pre></div> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->[<span class="hljs-number">7993</span>, <span class="hljs-number">170</span>, <span class="hljs-number">11303</span>, <span class="hljs-number">1200</span>, <span class="hljs-number">2443</span>, <span class="hljs-number">1110</span>, <span class="hljs-number">3014</span>]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1fsfgs5">ఈ outputs ను సరైన framework tensor గా మార్చిన తర్వాత, ఇవి ఈ అధ్యాయంలో ముందుగా చూసినట్లుగానే మోడల్కు ఇన్పుట్లుగా ఉపయోగించవచ్చు.</p> <blockquote class="tip"><p data-svelte-h="svelte-h6ayva">✏️ <strong>ప్రయత్నించండి!</strong> సెక్షన్ 2 లో ఉపయోగించిన రెండు వాక్యాలపై (<code>"I've been waiting for a HuggingFace course my whole life."</code> మరియు <code>"I hate this so much!"</code>) ఈ చివరి రెండు దశలను (tokenization మరియు input IDs గా మార్పు) మళ్లీ చేయండి. మీరు ముందుగా చూసినట్లే అదే input IDs వస్తున్నాయో లేదో తనిఖీ చేయండి!</p></blockquote> <h2 class="relative group"><a id="decoding" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#decoding"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Decoding</span></h2> <p data-svelte-h="svelte-1tnt3qp"><em>Decoding</em> అంటే పక్కదారి — vocabulary indices నుంచి మళ్లీ string కు రావడం. ఇది <code>decode()</code> పద్ధతి ద్వారా చేయవచ్చు:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->decoded_string = tokenizer.decode([<span class="hljs-number">7993</span>, <span class="hljs-number">170</span>, <span class="hljs-number">11303</span>, <span class="hljs-number">1200</span>, <span class="hljs-number">2443</span>, <span class="hljs-number">1110</span>, <span class="hljs-number">3014</span>]) | |
| <span class="hljs-built_in">print</span>(decoded_string)<!-- HTML_TAG_END --></pre></div> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-string">'Using a Transformer network is simple'</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-z9ls3p"><code>decode</code> పద్ధతి indices ను tokens గా మాత్రమే మార్చదు;<br> | |
| ముందు ఒకే పదానికి చెందిన subword tokens ను మళ్లీ కలిపి, చదవగలిగే వాక్యంగా మార్చుతుంది.<br> | |
| ఈ ప్రవర్తన, text జనరేషన్ చేసే మోడళ్లతో పని చేస్తున్నప్పుడు (prompt నుంచి text ఉత్పత్తి చేయడం, లేదా translation, summarization వంటి sequence-to-sequence సమస్యల్లో) చాలా ఉపయోగకరంగా ఉంటుంది.</p> <p data-svelte-h="svelte-1dwzwjp">ఇప్పటికే టోకనైజర్ చేయగలిగే atomic operations — tokenization, IDs కు మార్పు, మరియు IDs ను తిరిగి string గా మార్చడం — మీకు అర్థమై ఉండాలి.<br> | |
| అయితే ఇది ఐస్బర్గ్ పైభాగం మాత్రమే. తదుపరి విభాగంలో, ఈ విధానాన్ని గరిష్ట స్థాయికి తీసుకెళ్లి, దానివల్ల వచ్చే పరిమితులను ఎలా అధిగమించాలో చూస్తాం.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/course/blob/main/chapters/te/chapter2/4.mdx" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg> <span data-svelte-h="svelte-zjs2n5"><span class="underline">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1e95xo9 = { | |
| assets: "/docs/course/pr_1149/te", | |
| base: "/docs/course/pr_1149/te", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/course/pr_1149/te/_app/immutable/entry/start.eee4c1e0.js"), | |
| import("/docs/course/pr_1149/te/_app/immutable/entry/app.0f38558a.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 17], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 70 kB
- Xet hash:
- d5eebd912fd6fde4f7ea16deb6d9b0b52b348c8d0e8ad41ec407b72d07dc455c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.