Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"ကျွန်ုပ်၏ Dataset သည် Hub တွင် မရှိလျှင် ဘာလုပ်ရမလဲ။","local":"what-if-my-dataset-isnt-on-the-hub","sections":[{"title":"Local နှင့် Remote Datasets များနှင့် အလုပ်လုပ်ခြင်း","local":"working-with-local-and-remote-datasets","sections":[],"depth":2},{"title":"Local Dataset တစ်ခုကို Loading လုပ်ခြင်း","local":"loading-a-local-dataset","sections":[],"depth":2},{"title":"Remote Dataset တစ်ခုကို Loading လုပ်ခြင်း","local":"loading-a-remote-dataset","sections":[],"depth":2},{"title":"ဝေါဟာရ ရှင်းလင်းချက် (Glossary)","local":"ဝဟရ-ရငလငခက-glossary","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/course/pr_1114/my/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/entry/start.14794ee9.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/scheduler.893fe8c9.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/singletons.10fda3ce.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/index.bce52c8a.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/paths.89c82153.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/entry/app.a133f5c6.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/preload-helper.b1a719fd.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/index.b1df2166.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/nodes/0.510afdc1.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/nodes/37.d194c3c5.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.762ed9cc.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/Youtube.ec5d7916.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/CodeBlock.6cef0479.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1114/my/_app/immutable/chunks/CourseFloatingBanner.c1c08878.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"ကျွန်ုပ်၏ Dataset သည် Hub တွင် မရှိလျှင် ဘာလုပ်ရမလဲ။","local":"what-if-my-dataset-isnt-on-the-hub","sections":[{"title":"Local နှင့် Remote Datasets များနှင့် အလုပ်လုပ်ခြင်း","local":"working-with-local-and-remote-datasets","sections":[],"depth":2},{"title":"Local Dataset တစ်ခုကို Loading လုပ်ခြင်း","local":"loading-a-local-dataset","sections":[],"depth":2},{"title":"Remote Dataset တစ်ခုကို Loading လုပ်ခြင်း","local":"loading-a-remote-dataset","sections":[],"depth":2},{"title":"ဝေါဟာရ ရှင်းလင်းချက် (Glossary)","local":"ဝဟရ-ရငလငခက-glossary","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <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="what-if-my-dataset-isnt-on-the-hub" 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="#what-if-my-dataset-isnt-on-the-hub"><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>ကျွန်ုပ်၏ Dataset သည် Hub တွင် မရှိလျှင် ဘာလုပ်ရမလဲ။</span></h1> <div class="flex space-x-1 absolute z-10 right-0 top-0" style=""><a href="https://discuss.huggingface.co/t/chapter-5-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/chapter5/section2.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/chapter5/section2.ipynb" target="_blank"><img alt="Open In Studio Lab" class="!m-0" src="https://studiolab.sagemaker.aws/studiolab.svg"></a></div> <p data-svelte-h="svelte-y0xzyo">Datasets တွေကို download လုပ်ဖို့ <a href="https://huggingface.co/datasets" rel="nofollow">Hugging Face Hub</a> ကို ဘယ်လိုအသုံးပြုရမယ်ဆိုတာ သင်သိပါတယ်။ ဒါပေမယ့် သင့် laptop မှာ ဒါမှမဟုတ် remote server တစ်ခုမှာ သိမ်းဆည်းထားတဲ့ data တွေနဲ့ အလုပ်လုပ်ရတာမျိုး မကြာခဏ ကြုံတွေ့ရမှာပါ။ ဒီအပိုင်းမှာ 🤗 Datasets ကို အသုံးပြုပြီး Hugging Face Hub မှာ မရရှိနိုင်တဲ့ datasets တွေကို ဘယ်လို load လုပ်ရမလဲဆိုတာ ပြသပေးပါမယ်။</p> <iframe class="w-full xl:w-4/6 h-80" src="https://www.youtube-nocookie.com/embed/HyQgpJTkRdE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <h2 class="relative group"><a id="working-with-local-and-remote-datasets" 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="#working-with-local-and-remote-datasets"><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>Local နှင့် Remote Datasets များနှင့် အလုပ်လုပ်ခြင်း</span></h2> <p data-svelte-h="svelte-x056q6">🤗 Datasets က local နဲ့ remote datasets တွေကို load လုပ်ရာမှာ အသုံးပြုနိုင်တဲ့ loading scripts တွေကို ပံ့ပိုးပေးပါတယ်။ ၎င်းက အောက်ပါ common data formats များစွာကို ထောက်ပံ့ပေးပါတယ်။</p> <table data-svelte-h="svelte-19mvbg5"><thead><tr><th align="center">Data format</th> <th align="center">Loading script</th> <th align="center">Example</th></tr></thead> <tbody><tr><td align="center">CSV & TSV</td> <td align="center"><code>csv</code></td> <td align="center"><code>load_dataset("csv", data_files="my_file.csv")</code></td></tr> <tr><td align="center">Text files</td> <td align="center"><code>text</code></td> <td align="center"><code>load_dataset("text", data_files="my_file.txt")</code></td></tr> <tr><td align="center">JSON & JSON Lines</td> <td align="center"><code>json</code></td> <td align="center"><code>load_dataset("json", data_files="my_file.jsonl")</code></td></tr> <tr><td align="center">Pickled DataFrames</td> <td align="center"><code>pandas</code></td> <td align="center"><code>load_dataset("pandas", data_files="my_dataframe.pkl")</code></td></tr></tbody></table> <p data-svelte-h="svelte-rsimgj">ဇယားမှာ ပြသထားတဲ့အတိုင်း၊ data format တစ်ခုစီအတွက် <code>load_dataset()</code> function မှာ loading script အမျိုးအစားကို သတ်မှတ်ဖို့ပဲ လိုပါတယ်။ ဒါ့အပြင် file တစ်ခု သို့မဟုတ် တစ်ခုထက်ပိုတဲ့ files တွေရဲ့ path ကို သတ်မှတ်ပေးမယ့် <code>data_files</code> argument လည်း လိုပါတယ်။ local files ကနေ dataset တစ်ခုကို load လုပ်ခြင်းဖြင့် စတင်ပါမယ်၊ နောက်ပိုင်းမှာ remote files တွေနဲ့ ဘယ်လိုလုပ်ရမလဲဆိုတာ ကြည့်ရပါမယ်။</p> <h2 class="relative group"><a id="loading-a-local-dataset" 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-a-local-dataset"><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>Local Dataset တစ်ခုကို Loading လုပ်ခြင်း</span></h2> <p data-svelte-h="svelte-1v3i3wl">ဒီဥပမာအတွက် <a href="https://github.com/crux82/squad-it/" rel="nofollow">SQuAD-it dataset</a> ကို ကျွန်တော်တို့ အသုံးပြုပါမယ်။ ဒါက Italian ဘာသာစကားနဲ့ မေးခွန်းဖြေဆိုခြင်း (question answering) အတွက် large-scale dataset တစ်ခု ဖြစ်ပါတယ်။</p> <p data-svelte-h="svelte-17o08po">training နဲ့ test splits တွေကို GitHub မှာ host လုပ်ထားတာကြောင့်၊ ရိုးရှင်းတဲ့ <code>wget</code> command တစ်ခုနဲ့ download လုပ်နိုင်ပါတယ်။</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 -->!wget https://github.com/crux82/squad-it/raw/master/SQuAD_it-train.json.gz | |
| !wget https://github.com/crux82/squad-it/raw/master/SQuAD_it-test.json.gz<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-5lj5xt">ဒါက <em>SQuAD_it-train.json.gz</em> နဲ့ <em>SQuAD_it-test.json.gz</em> လို့ခေါ်တဲ့ compressed files နှစ်ခုကို download လုပ်ပါလိမ့်မယ်။ ဒါတွေကို Linux ရဲ့ <code>gzip</code> command နဲ့ decompress လုပ်နိုင်ပါတယ်။</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 -->!gzip -dkv SQuAD_it-*.json.gz<!-- 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 -->SQuAD_it-test.json.gz: 87.4% -- replaced with SQuAD_it-test.json | |
| SQuAD_it-train.json.gz: 82.2% -- replaced with SQuAD_it-train.json<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-gztrds">compressed files တွေဟာ <em>SQuAD_it-train.json</em> နဲ့ <em>SQuAD_it-test.json</em> တို့နဲ့ အစားထိုးခံရပြီး data တွေကို JSON format နဲ့ သိမ်းဆည်းထားတာကို တွေ့ရပါတယ်။</p> <blockquote class="tip" data-svelte-h="svelte-13ivie0"><p>✎ အပေါ်က shell commands တွေမှာ <code>!</code> character ဘာကြောင့် ပါလဲဆိုတာ သင်တွေးနေမယ်ဆိုရင်၊ ဒါတွေက Jupyter notebook ထဲမှာ run နေလို့ပါပဲ။ သင် terminal ထဲမှာ dataset ကို download လုပ်ပြီး unzip လုပ်ချင်တယ်ဆိုရင် prefix ကို ရိုးရှင်းစွာ ဖယ်ရှားလိုက်ပါ။</p></blockquote> <p data-svelte-h="svelte-ak9pqn"><code>load_dataset()</code> function နဲ့ JSON file တစ်ခုကို load လုပ်ဖို့၊ ကျွန်တော်တို့ဟာ သာမန် JSON (nested dictionary နဲ့ ဆင်တူ) ဒါမှမဟုတ် JSON Lines (line-separated JSON) နဲ့ အလုပ်လုပ်နေတာ ဟုတ်မဟုတ် သိဖို့ပဲ လိုပါတယ်။ question answering datasets အများစုလိုပဲ၊ SQuAD-it က nested format ကို အသုံးပြုပြီး text အားလုံးကို <code>data</code> field ထဲမှာ သိမ်းဆည်းထားပါတယ်။ ဒါက <code>field</code> argument ကို အောက်ပါအတိုင်း သတ်မှတ်ပေးခြင်းဖြင့် dataset ကို load လုပ်နိုင်တယ်လို့ ဆိုလိုပါတယ်။</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> datasets <span class="hljs-keyword">import</span> load_dataset | |
| squad_it_dataset = load_dataset(<span class="hljs-string">"json"</span>, data_files=<span class="hljs-string">"SQuAD_it-train.json"</span>, field=<span class="hljs-string">"data"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-11igst9">default အားဖြင့်၊ local files တွေကို load လုပ်ခြင်းက <code>train</code> split ပါဝင်တဲ့ <code>DatasetDict</code> object တစ်ခုကို ဖန်တီးပါတယ်။ ဒါကို <code>squad_it_dataset</code> object ကို စစ်ဆေးကြည့်ခြင်းဖြင့် မြင်နိုင်ပါတယ်။</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 -->squad_it_dataset<!-- 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 -->DatasetDict({ | |
| train: Dataset({ | |
| features: [<span class="hljs-string">'title'</span>, <span class="hljs-string">'paragraphs'</span>], | |
| num_rows: <span class="hljs-number">442</span> | |
| }) | |
| })<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1w4cmue">ဒါက ကျွန်တော်တို့ကို rows အရေအတွက်နဲ့ training set နဲ့ ဆက်စပ်နေတဲ့ column names တွေကို ပြသပါတယ်။ <code>train</code> split ထဲက ဥပမာတစ်ခုကို အောက်ပါအတိုင်း indexing လုပ်ခြင်းဖြင့် ကြည့်ရှုနိုင်ပါတယ်။</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 -->squad_it_dataset[<span class="hljs-string">"train"</span>][<span class="hljs-number">0</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">"title"</span>: <span class="hljs-string">"Terremoto del Sichuan del 2008"</span>, | |
| <span class="hljs-string">"paragraphs"</span>: [ | |
| { | |
| <span class="hljs-string">"context"</span>: <span class="hljs-string">"Il terremoto del Sichuan del 2008 o il terremoto..."</span>, | |
| <span class="hljs-string">"qas"</span>: [ | |
| { | |
| <span class="hljs-string">"answers"</span>: [{<span class="hljs-string">"answer_start"</span>: <span class="hljs-number">29</span>, <span class="hljs-string">"text"</span>: <span class="hljs-string">"2008"</span>}], | |
| <span class="hljs-string">"id"</span>: <span class="hljs-string">"56cdca7862d2951400fa6826"</span>, | |
| <span class="hljs-string">"question"</span>: <span class="hljs-string">"In quale anno si è verificato il terremoto nel Sichuan?"</span>, | |
| }, | |
| ... | |
| ], | |
| }, | |
| ... | |
| ], | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-f057z4">ကောင်းပါပြီ၊ ကျွန်တော်တို့ရဲ့ ပထမဆုံး local dataset ကို load လုပ်ခဲ့ပါပြီ။ ဒါပေမယ့် ဒါက training set အတွက် အလုပ်ဖြစ်ခဲ့ပေမယ့်၊ ကျွန်တော်တို့ တကယ်လိုချင်တာက <code>train</code> နဲ့ <code>test</code> splits နှစ်ခုလုံးကို <code>DatasetDict</code> object တစ်ခုတည်းမှာ ထည့်သွင်းဖို့ပါပဲ။ ဒါမှ <code>Dataset.map()</code> functions တွေကို splits နှစ်ခုလုံးပေါ်မှာ တစ်ပြိုင်နက်တည်း အသုံးပြုနိုင်မှာပါ။ ဒါကိုလုပ်ဖို့၊ <code>data_files</code> argument ကို dictionary တစ်ခု ပေးနိုင်ပါတယ်။ အဲဒီ dictionary က split name တစ်ခုစီကို အဲဒီ split နဲ့ ဆက်စပ်နေတဲ့ file တစ်ခုသို့ map လုပ်ပေးပါတယ်။</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 -->data_files = {<span class="hljs-string">"train"</span>: <span class="hljs-string">"SQuAD_it-train.json"</span>, <span class="hljs-string">"test"</span>: <span class="hljs-string">"SQuAD_it-test.json"</span>} | |
| squad_it_dataset = load_dataset(<span class="hljs-string">"json"</span>, data_files=data_files, field=<span class="hljs-string">"data"</span>) | |
| squad_it_dataset<!-- 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 -->DatasetDict({ | |
| train: Dataset({ | |
| features: [<span class="hljs-string">'title'</span>, <span class="hljs-string">'paragraphs'</span>], | |
| num_rows: <span class="hljs-number">442</span> | |
| }) | |
| test: Dataset({ | |
| features: [<span class="hljs-string">'title'</span>, <span class="hljs-string">'paragraphs'</span>], | |
| num_rows: <span class="hljs-number">48</span> | |
| }) | |
| })<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-91tx34">ဒါက ကျွန်တော်တို့ လိုချင်တာ အတိအကျပါပဲ။ အခုဆိုရင် data ကို သန့်ရှင်းရေးလုပ်ဖို့၊ reviews တွေကို tokenize လုပ်ဖို့ စတဲ့ preprocessing techniques မျိုးစုံကို အသုံးပြုနိုင်ပါပြီ။</p> <blockquote class="tip" data-svelte-h="svelte-1meznbo"><p><code>load_dataset()</code> function ရဲ့ <code>data_files</code> argument က အတော်လေး ပြောင်းလွယ်ပြင်လွယ်ရှိပြီး file path တစ်ခုတည်း၊ file paths စာရင်းတစ်ခု ဒါမှမဟုတ် split names တွေကို file paths တွေနဲ့ map လုပ်တဲ့ dictionary တစ်ခု ဖြစ်နိုင်ပါတယ်။ Unix shell က အသုံးပြုတဲ့ စည်းမျဉ်းတွေအရ သတ်မှတ်ထားတဲ့ pattern နဲ့ ကိုက်ညီတဲ့ files တွေကိုလည်း glob လုပ်နိုင်ပါတယ်။ (ဥပမာ- directory တစ်ခုထဲက JSON files အားလုံးကို <code>data_files="*.json"</code> လို့ သတ်မှတ်ခြင်းဖြင့် single split အဖြစ် glob လုပ်နိုင်ပါတယ်။) အသေးစိတ်အချက်အလက်တွေအတွက် 🤗 Datasets <a href="https://huggingface.co/docs/datasets/loading#local-and-remote-files" rel="nofollow">documentation</a> ကို ကြည့်ပါ။</p></blockquote> <p data-svelte-h="svelte-vm2ign">🤗 Datasets မှာရှိတဲ့ loading scripts တွေက input files တွေကို အလိုအလျောက် decompress လုပ်ခြင်းကို ထောက်ပံ့ပေးပါတယ်၊ ဒါကြောင့် <code>data_files</code> argument ကို compressed files တွေဆီ တိုက်ရိုက်ညွှန်ပြခြင်းဖြင့် <code>gzip</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 -->data_files = {<span class="hljs-string">"train"</span>: <span class="hljs-string">"SQuAD_it-train.json.gz"</span>, <span class="hljs-string">"test"</span>: <span class="hljs-string">"SQuAD_it-test.json.gz"</span>} | |
| squad_it_dataset = load_dataset(<span class="hljs-string">"json"</span>, data_files=data_files, field=<span class="hljs-string">"data"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-d2ayeu">ဒါက GZIP files အများအပြားကို ကိုယ်တိုင် decompress လုပ်ချင်ခြင်းမရှိတဲ့အခါ အသုံးဝင်ပါတယ်။ အလိုအလျောက် decompression က ZIP နဲ့ TAR လိုမျိုး အခြား common formats တွေနဲ့လည်း သက်ဆိုင်တာကြောင့်၊ သင် <code>data_files</code> ကို compressed files တွေဆီ ညွှန်ပြဖို့ပဲ လိုအပ်ပြီး အဆင်သင့်ပါပဲ!</p> <p data-svelte-h="svelte-aalrx8">သင့် laptop ဒါမှမဟုတ် desktop ပေါ်မှာ local files တွေကို ဘယ်လို load လုပ်ရမယ်ဆိုတာ သိပြီဆိုတော့၊ remote files တွေကို loading လုပ်တာကို ကြည့်ရအောင်။</p> <h2 class="relative group"><a id="loading-a-remote-dataset" 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-a-remote-dataset"><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>Remote Dataset တစ်ခုကို Loading လုပ်ခြင်း</span></h2> <p data-svelte-h="svelte-1exlji0">သင်က ကုမ္ပဏီတစ်ခုမှာ data scientist ဒါမှမဟုတ် coder အဖြစ် အလုပ်လုပ်နေတယ်ဆိုရင်၊ သင် analyze လုပ်ချင်တဲ့ datasets တွေဟာ remote server တစ်ခုမှာ သိမ်းဆည်းထားနိုင်ခြေ များပါတယ်။ ကံကောင်းစွာနဲ့ပဲ၊ remote files တွေကို load လုပ်တာက local files တွေကို load လုပ်တာလောက် ရိုးရှင်းပါတယ်။ local files တွေရဲ့ path ကို ပေးမယ့်အစား၊ <code>load_dataset()</code> function ရဲ့ <code>data_files</code> argument ကို remote files တွေ သိမ်းဆည်းထားတဲ့ URL တစ်ခု သို့မဟုတ် တစ်ခုထက်ပိုတဲ့ URL တွေဆီ ညွှန်ပြပါတယ်။ ဥပမာ၊ GitHub မှာ host လုပ်ထားတဲ့ SQuAD-it dataset အတွက်၊ ကျွန်တော်တို့ <code>data_files</code> ကို <em>SQuAD_it-*.json.gz</em> URLs တွေဆီ အောက်ပါအတိုင်း ညွှန်ပြနိုင်ပါတယ်။</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 -->url = <span class="hljs-string">"https://github.com/crux82/squad-it/raw/master/"</span> | |
| data_files = { | |
| <span class="hljs-string">"train"</span>: url + <span class="hljs-string">"SQuAD_it-train.json.gz"</span>, | |
| <span class="hljs-string">"test"</span>: url + <span class="hljs-string">"SQuAD_it-test.json.gz"</span>, | |
| } | |
| squad_it_dataset = load_dataset(<span class="hljs-string">"json"</span>, data_files=data_files, field=<span class="hljs-string">"data"</span>)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-j9x5ub">ဒါက အပေါ်မှာ ရရှိခဲ့တဲ့ <code>DatasetDict</code> object တူတူကို ပြန်ပေးပါတယ်၊ ဒါပေမယ့် <em>SQuAD_it-*.json.gz</em> files တွေကို ကိုယ်တိုင် download လုပ်ပြီး decompress လုပ်ရမယ့်အဆင့်ကို ကျွန်တော်တို့အတွက် သက်သာစေပါတယ်။ ဒါက Hugging Face Hub မှာ host လုပ်ထားတာ မဟုတ်တဲ့ datasets တွေကို load လုပ်တဲ့ နည်းလမ်းအမျိုးမျိုးကို ကျွန်တော်တို့ရဲ့ လေ့လာမှုကို နိဂုံးချုပ်လိုက်ပါပြီ။ အခု ကျွန်တော်တို့ ကစားစရာ dataset တစ်ခု ရရှိပြီဆိုတော့၊ data-wrangling techniques အမျိုးမျိုးနဲ့ လက်တွေ့လုပ်ဆောင်ကြည့်ရအောင်။</p> <blockquote class="tip" data-svelte-h="svelte-g5zszz"><p>✏️ <strong>စမ်းသပ်ကြည့်ပါ။</strong> GitHub မှာ ဒါမှမဟုတ် <a href="https://archive.ics.uci.edu/ml/index.php" rel="nofollow">UCI Machine Learning Repository</a> မှာ host လုပ်ထားတဲ့ အခြား dataset တစ်ခုကို ရွေးပြီး အထက်မှာ မိတ်ဆက်ခဲ့တဲ့ နည်းလမ်းတွေကို အသုံးပြုပြီး local နဲ့ remote နှစ်မျိုးလုံး load လုပ်ကြည့်ပါ။ bonus အမှတ်များအတွက်၊ CSV ဒါမှမဟုတ် text format နဲ့ သိမ်းဆည်းထားတဲ့ dataset တစ်ခုကို load လုပ်ကြည့်ပါ (ဒီ formats တွေအကြောင်း အသေးစိတ်အချက်အလက်တွေအတွက် <a href="https://huggingface.co/docs/datasets/loading#local-and-remote-files" rel="nofollow">documentation</a> ကို ကြည့်ပါ)။</p></blockquote> <h2 class="relative group"><a id="ဝဟရ-ရငလငခက-glossary" 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="#ဝဟရ-ရငလငခက-glossary"><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>ဝေါဟာရ ရှင်းလင်းချက် (Glossary)</span></h2> <ul data-svelte-h="svelte-174ygra"><li><strong>Hugging Face Hub</strong>: AI မော်ဒယ်တွေ၊ datasets တွေနဲ့ demo တွေကို အခြားသူတွေနဲ့ မျှဝေဖို့၊ ရှာဖွေဖို့နဲ့ ပြန်လည်အသုံးပြုဖို့အတွက် အွန်လိုင်း platform တစ်ခု ဖြစ်ပါတယ်။</li> <li><strong>Local Dataset</strong>: သင့်ကွန်ပျူတာ (laptop သို့မဟုတ် desktop) ၏ hard drive ပေါ်တွင် သိမ်းဆည်းထားသော dataset။</li> <li><strong>Remote Dataset</strong>: အွန်လိုင်းဆာဗာ သို့မဟုတ် cloud storage တွင် သိမ်းဆည်းထားသော dataset။</li> <li><strong>🤗 Datasets</strong>: Hugging Face က ထုတ်လုပ်ထားတဲ့ library တစ်ခုဖြစ်ပြီး AI မော်ဒယ်တွေ လေ့ကျင့်ဖို့အတွက် ဒေတာအစုအဝေး (datasets) တွေကို လွယ်လွယ်ကူကူ ဝင်ရောက်ရယူ၊ စီမံခန့်ခွဲပြီး အသုံးပြုနိုင်စေပါတယ်။</li> <li><strong>Loading Scripts</strong>: 🤗 Datasets library အတွင်းရှိ code များဖြစ်ပြီး မတူညီသော data formats (CSV, JSON, Text, Pandas) မှ datasets များကို load လုပ်ရန်အတွက် တာဝန်ယူသည်။</li> <li><strong>CSV (Comma-Separated Values)</strong>: ကော်မာများဖြင့် ပိုင်းခြားထားသော ဒေတာတန်ဖိုးများပါဝင်သည့် plain text file format။</li> <li><strong>TSV (Tab-Separated Values)</strong>: Tab များဖြင့် ပိုင်းခြားထားသော ဒေတာတန်ဖိုးများပါဝင်သည့် plain text file format။</li> <li><strong>Text Files</strong>: စာသားအချက်အလက်များသာ ပါဝင်သော ဖိုင်များ။</li> <li><strong>JSON (JavaScript Object Notation)</strong>: ဒေတာများကို ပေါ့ပေါ့ပါးပါး ဖလှယ်နိုင်သော format ဖြစ်ပြီး လူသားများ ဖတ်ရှုရလွယ်ကူပြီး စက်များ စီမံဆောင်ရွက်ရလွယ်ကူသည်။</li> <li><strong>JSON Lines</strong>: JSON objects များကို line တစ်ကြောင်းစီတွင် တစ်ခုစီ ထားရှိသော JSON format ၏ ပုံစံတစ်မျိုး။</li> <li><strong>Pickled DataFrames</strong>: Python ၏ <code>pickle</code> module ကို အသုံးပြု၍ Python object (ဥပမာ- Pandas DataFrame) ကို binary format ဖြင့် သိမ်းဆည်းထားသော ဖိုင်။</li> <li><strong><code>load_dataset()</code> Function</strong>: Hugging Face Datasets library မှ dataset များကို download လုပ်ပြီး cache လုပ်ရန် အသုံးပြုသော function။</li> <li><strong><code>data_files</code> Argument</strong>: <code>load_dataset()</code> function တွင် dataset files (local သို့မဟုတ် remote) ၏ path (သို့မဟုတ် URL) ကို သတ်မှတ်ရန် အသုံးပြုသော argument။</li> <li><strong>SQuAD-it Dataset</strong>: Italian ဘာသာစကားဖြင့် မေးခွန်းဖြေဆိုခြင်း (question answering) အတွက် အသုံးပြုသော dataset။</li> <li><strong>GitHub</strong>: Version control အတွက် Git ကို အသုံးပြုသည့် web-based platform တစ်ခုဖြစ်ပြီး code များနှင့် project များကို host လုပ်သည်။</li> <li><strong><code>wget</code> Command</strong>: ကွန်ရက်မှ ဖိုင်များကို download လုပ်ရန်အတွက် Unix/Linux command-line utility။</li> <li><strong>Compressed Files</strong>: ဖိုင်အရွယ်အစားကို လျှော့ချရန်အတွက် ဖိသိပ်ထားသော ဖိုင်များ (ဥပမာ- <code>.gz</code>, <code>.zip</code>, <code>.tar</code>)။</li> <li><strong><code>gzip</code> Command</strong>: GZIP format ဖြင့် ဖိုင်များကို compress (ဖိသိပ်) သို့မဟုတ် decompress (ဖိသိပ်မှုဖြေလျှော့) ရန်အတွက် Linux command-line utility။</li> <li><strong><code>!</code> Character</strong>: Jupyter/Colab Notebooks များတွင် shell commands များကို run ရန်အတွက် အသုံးပြုသော prefix။</li> <li><strong>Jupyter Notebook</strong>: code, text, images, နှင့် mathematical equations တို့ကို ပေါင်းစပ်နိုင်သော interactive computing environment။</li> <li><strong>Terminal</strong>: command-line interface မှတစ်ဆင့် ကွန်ပျူတာကို ထိန်းချုပ်ရန် အသုံးပြုသော interface။</li> <li><strong>Nested Dictionary</strong>: dictionary အတွင်း၌ အခြား dictionary များ ပါဝင်သော dictionary။</li> <li><strong><code>field</code> Argument</strong>: <code>load_dataset()</code> function တွင် JSON file အတွင်းရှိ မည်သည့် field မှ data များကို load လုပ်ရမည်ကို သတ်မှတ်ရန် အသုံးပြုသော argument။</li> <li><strong><code>DatasetDict</code> Object</strong>: Training set, validation set, နှင့် test set ကဲ့သို့သော dataset အများအပြားကို dictionary ပုံစံဖြင့် သိမ်းဆည်းထားသော object။</li> <li><strong><code>train</code> Split</strong>: Model ကို လေ့ကျင့်ရန်အတွက် အသုံးပြုသော dataset အပိုင်း။</li> <li><strong><code>test</code> Split</strong>: Model ၏ နောက်ဆုံး စွမ်းဆောင်ရည်ကို တိုင်းတာရန် အသုံးပြုသော dataset အပိုင်း။</li> <li><strong>Rows (Examples)</strong>: dataset အတွင်းရှိ တစ်ခုချင်းစီသော data entry များ။</li> <li><strong>Column Names (Features)</strong>: dataset အတွင်းရှိ attributes များ သို့မဟုတ် ကဏ္ဍများ။</li> <li><strong>Indexing</strong>: dataset (သို့မဟုတ် list, dictionary) အတွင်းရှိ သီးခြား element တစ်ခုကို ၎င်း၏ index (သို့မဟုတ် key) ကို အသုံးပြု၍ ဝင်ရောက်ကြည့်ရှုခြင်း။</li> <li><strong>Preprocessing Techniques</strong>: ဒေတာများကို model က နားလည်ပြီး လုပ်ဆောင်နိုင်တဲ့ ပုံစံအဖြစ် ပြောင်းလဲပြင်ဆင်ခြင်း လုပ်ငန်းစဉ်အတွက် အသုံးပြုသော နည်းလမ်းများ။</li> <li><strong>Tokenize</strong>: စာသား (သို့မဟုတ် အခြားဒေတာ) ကို AI မော်ဒယ်များ စီမံဆောင်ရွက်နိုင်ရန် tokens တွေအဖြစ် ပိုင်းခြားပေးသည့် လုပ်ငန်းစဉ်။</li> <li><strong>Glob Files</strong>: Unix shell တွင် wildcard (ဥပမာ- <code>*</code>, <code>?</code>) များကို အသုံးပြု၍ pattern တစ်ခုနှင့် ကိုက်ညီသော ဖိုင်များကို ရှာဖွေခြင်း။</li> <li><strong>URL (Uniform Resource Locator)</strong>: web ပေါ်ရှိ အရင်းအမြစ်တစ်ခု (ဥပမာ- web page, file) ၏ လိပ်စာ။</li> <li><strong>Data-wrangling Techniques</strong>: ကုန်ကြမ်းဒေတာ (raw data) များကို ပိုမိုအသုံးဝင်ပြီး သန့်ရှင်းသော ပုံစံသို့ ပြောင်းလဲရန်အတွက် လုပ်ဆောင်သော လုပ်ငန်းစဉ်များ။</li> <li><strong>UCI Machine Learning Repository</strong>: Machine learning datasets များစွာကို စုစည်းထားသော repository တစ်ခု။</li></ul> <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/my/chapter5/2.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_tyugt6 = { | |
| assets: "/docs/course/pr_1114/my", | |
| base: "/docs/course/pr_1114/my", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/course/pr_1114/my/_app/immutable/entry/start.14794ee9.js"), | |
| import("/docs/course/pr_1114/my/_app/immutable/entry/app.a133f5c6.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 37], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 59.2 kB
- Xet hash:
- e68c54df35f010988292d89c9e242ac1fac1d993580cee74ac4f975e8d7b44c3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.