Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Transformers တွေက ဘာတွေလုပ်နိုင်လဲ။","local":"transformers-what-can-they-do","sections":[{"title":"Transformers တွေက နေရာတိုင်းမှာ ရှိနေပါတယ်!","local":"transformers-are-everywhere","sections":[],"depth":2},{"title":"Pipelines တွေနဲ့ အလုပ်လုပ်ခြင်း","local":"working-with-pipelines","sections":[],"depth":2},{"title":"မတူညီသော နယ်ပယ်များအတွက် ရနိုင်သော pipelines များ","local":"မတညသ-နယပယမအတက-ရနငသ-pipelines-မ","sections":[{"title":"စာသား Pipelines (Text pipelines)","local":"စသ-pipelines-text-pipelines","sections":[],"depth":3},{"title":"ပုံရိပ် Pipelines (Image pipelines)","local":"ပရပ-pipelines-image-pipelines","sections":[],"depth":3},{"title":"အသံ Pipelines (Audio pipelines)","local":"အသ-pipelines-audio-pipelines","sections":[],"depth":3},{"title":"Multimodal pipelines","local":"multimodal-pipelines","sections":[],"depth":3}],"depth":2},{"title":"Zero-shot classification","local":"zero-shot-classification","sections":[],"depth":2},{"title":"စာသား ဖန်တီးခြင်း (Text generation)","local":"text-generation","sections":[],"depth":2},{"title":"Hub မှ မည်သည့်မော်ဒယ်ကိုမဆို pipeline ထဲတွင် အသုံးပြုခြင်း","local":"using-any-model-from-the-hub-in-a-pipeline","sections":[{"title":"Inference Providers များ","local":"inference-providers","sections":[],"depth":3}],"depth":2},{"title":"Mask filling","local":"mask-filling","sections":[],"depth":2},{"title":"Named entity recognition","local":"named-entity-recognition","sections":[],"depth":2},{"title":"မေးခွန်းဖြေဆိုခြင်း (Question answering)","local":"question-answering","sections":[],"depth":2},{"title":"အနှစ်ချုပ်ခြင်း(Summarization)","local":"summarization","sections":[],"depth":2},{"title":"ဘာသာပြန်ခြင်း (Translation)","local":"translation","sections":[],"depth":2},{"title":"ပုံရိပ်နှင့် အသံ Pipelines များ (Image and audio pipelines)","local":"ပရပနင-အသ-pipelines-မ-image-and-audio-pipelines","sections":[{"title":"Image classification","local":"image-classification","sections":[],"depth":3},{"title":"Automatic speech recognition","local":"automatic-speech-recognition","sections":[],"depth":3}],"depth":2},{"title":"ဒေတာ အရင်းအမြစ်မျိုးစုံမှ ဒေတာများကို ပေါင်းစပ်ခြင်း (Combining data from multiple sources)","local":"ဒတ-အရငအမစမစမ-ဒတမက-ပငစပခင-combining-data-from-multiple-sources","sections":[],"depth":2},{"title":"နိဂုံးချုပ်","local":"နဂခပ","sections":[],"depth":2},{"title":"ဝေါဟာရ ရှင်းလင်းချက် (Glossary)","local":"ဝဟရ-ရငလငခက-glossary","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/course/pr_1107/my/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/entry/start.5c6233a8.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/scheduler.0835143d.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/singletons.c8b11329.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/index.1bab75e2.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/paths.e4a366ea.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/entry/app.55586789.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/preload-helper.5f7c8393.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/index.3d7efe79.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/nodes/0.0cec3d6c.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/nodes/7.85afe7f2.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/Youtube.96e00463.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/CodeBlock.116ed840.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/CourseFloatingBanner.860ea6e4.js"> | |
| <link rel="modulepreload" href="/docs/course/pr_1107/my/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.0b02b772.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Transformers တွေက ဘာတွေလုပ်နိုင်လဲ။","local":"transformers-what-can-they-do","sections":[{"title":"Transformers တွေက နေရာတိုင်းမှာ ရှိနေပါတယ်!","local":"transformers-are-everywhere","sections":[],"depth":2},{"title":"Pipelines တွေနဲ့ အလုပ်လုပ်ခြင်း","local":"working-with-pipelines","sections":[],"depth":2},{"title":"မတူညီသော နယ်ပယ်များအတွက် ရနိုင်သော pipelines များ","local":"မတညသ-နယပယမအတက-ရနငသ-pipelines-မ","sections":[{"title":"စာသား Pipelines (Text pipelines)","local":"စသ-pipelines-text-pipelines","sections":[],"depth":3},{"title":"ပုံရိပ် Pipelines (Image pipelines)","local":"ပရပ-pipelines-image-pipelines","sections":[],"depth":3},{"title":"အသံ Pipelines (Audio pipelines)","local":"အသ-pipelines-audio-pipelines","sections":[],"depth":3},{"title":"Multimodal pipelines","local":"multimodal-pipelines","sections":[],"depth":3}],"depth":2},{"title":"Zero-shot classification","local":"zero-shot-classification","sections":[],"depth":2},{"title":"စာသား ဖန်တီးခြင်း (Text generation)","local":"text-generation","sections":[],"depth":2},{"title":"Hub မှ မည်သည့်မော်ဒယ်ကိုမဆို pipeline ထဲတွင် အသုံးပြုခြင်း","local":"using-any-model-from-the-hub-in-a-pipeline","sections":[{"title":"Inference Providers များ","local":"inference-providers","sections":[],"depth":3}],"depth":2},{"title":"Mask filling","local":"mask-filling","sections":[],"depth":2},{"title":"Named entity recognition","local":"named-entity-recognition","sections":[],"depth":2},{"title":"မေးခွန်းဖြေဆိုခြင်း (Question answering)","local":"question-answering","sections":[],"depth":2},{"title":"အနှစ်ချုပ်ခြင်း(Summarization)","local":"summarization","sections":[],"depth":2},{"title":"ဘာသာပြန်ခြင်း (Translation)","local":"translation","sections":[],"depth":2},{"title":"ပုံရိပ်နှင့် အသံ Pipelines များ (Image and audio pipelines)","local":"ပရပနင-အသ-pipelines-မ-image-and-audio-pipelines","sections":[{"title":"Image classification","local":"image-classification","sections":[],"depth":3},{"title":"Automatic speech recognition","local":"automatic-speech-recognition","sections":[],"depth":3}],"depth":2},{"title":"ဒေတာ အရင်းအမြစ်မျိုးစုံမှ ဒေတာများကို ပေါင်းစပ်ခြင်း (Combining data from multiple sources)","local":"ဒတ-အရငအမစမစမ-ဒတမက-ပငစပခင-combining-data-from-multiple-sources","sections":[],"depth":2},{"title":"နိဂုံးချုပ်","local":"နဂခပ","sections":[],"depth":2},{"title":"ဝေါဟာရ ရှင်းလင်းချက် (Glossary)","local":"ဝဟရ-ရငလငခက-glossary","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="transformers-what-can-they-do" 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="#transformers-what-can-they-do"><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>Transformers တွေက ဘာတွေလုပ်နိုင်လဲ။</span></h1> <div class="flex space-x-1 absolute z-10 right-0 top-0"><a href="https://discuss.huggingface.co/t/chapter-1-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/chapter1/section3.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/chapter1/section3.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-b4qs7m">ဒီအပိုင်းမှာတော့ Transformer မော်ဒယ်တွေ ဘာတွေလုပ်နိုင်လဲဆိုတာကို ကြည့်ရှုသွားမှာဖြစ်ပြီး Hugging Face ရဲ့ 🤗 Transformers library ထဲက ပထမဆုံး ကိရိယာဖြစ်တဲ့ <code>pipeline()</code> function ကို အသုံးပြုသွားမှာပါ။</p> <blockquote class="tip" data-svelte-h="svelte-ogl7do"><p>👀 ညာဘက်အပေါ်ထောင့်မှာရှိတဲ့ <em>Open in Colab</em> ခလုတ်ကို မြင်ရလား။ ဒီကဏ္ဍက code ဥပမာတွေ အားလုံးပါဝင်တဲ့ Google Colab notebook ကို ဖွင့်ဖို့ အဲဒီခလုတ်ကို နှိပ်လိုက်ပါ။ ဒီခလုတ်က code ဥပမာတွေ ပါဝင်တဲ့ မည်သည့်ကဏ္ဍမှာမဆို ရှိနေမှာပါ။</p> <p>ဥပမာတွေကို ကိုယ်တိုင် run ချင်တယ်ဆိုရင်တော့ <a href="/course/chapter0">setup</a> ကို လေ့လာကြည့်ဖို့ ကျွန်တော်တို့ အကြံပြုပါတယ်။</p></blockquote> <h2 class="relative group"><a id="transformers-are-everywhere" 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="#transformers-are-everywhere"><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>Transformers တွေက နေရာတိုင်းမှာ ရှိနေပါတယ်!</span></h2> <p data-svelte-h="svelte-2ry6jh">Transformer မော်ဒယ်တွေကို Natural Language Processing (NLP), computer vision, audio processing အပါအဝင် မတူညီတဲ့ နယ်ပယ်အသီးသီးက လုပ်ငန်းတာဝန်မျိုးစုံကို ဖြေရှင်းဖို့ အသုံးပြုပါတယ်။ အောက်ဖော်ပြပါ ကုမ္ပဏီတွေနဲ့ အဖွဲ့အစည်းအချို့ကတော့ Hugging Face နဲ့ Transformer မော်ဒယ်တွေကို အသုံးပြုနေကြပြီး ၎င်းတို့ရဲ့ မော်ဒယ်တွေကို မျှဝေခြင်းဖြင့် လူ့အဖွဲ့အစည်းကိုလည်း ပံ့ပိုးကူညီပေးနေကြပါတယ်။</p> <img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter1/companies.PNG" alt="Companies using Hugging Face" width="100%"> <p data-svelte-h="svelte-ocdhry"><a href="https://huggingface.co/docs/transformers/index" rel="nofollow">🤗 Transformers library</a> ကတော့ အဲဒီမျှဝေထားတဲ့ မော်ဒယ်တွေကို ဖန်တီးပြီး အသုံးပြုနိုင်တဲ့ functionality တွေကို ပံ့ပိုးပေးပါတယ်။ <a href="https://huggingface.co/models" rel="nofollow">Model Hub</a> မှာတော့ လူတိုင်း download လုပ်ပြီး အသုံးပြုနိုင်တဲ့ ကြိုတင်လေ့ကျင့်ထားသော (pretrained) မော်ဒယ်ပေါင်း သန်းချီ ပါဝင်ပါတယ်။ သင်ရဲ့ ကိုယ်ပိုင်မော်ဒယ်တွေကိုလည်း Hub ကို upload တင်နိုင်ပါတယ်။</p> <blockquote class="tip" data-svelte-h="svelte-1io4pfl"><p>⚠️ Hugging Face Hub ဟာ Transformer မော်ဒယ်တွေအတွက်ပဲ ကန့်သတ်ထားတာ မဟုတ်ပါဘူး။ လူတိုင်းက သူတို့လိုချင်တဲ့ မည်သည့်မော်ဒယ် သို့မဟုတ် dataset ကိုမဆို မျှဝေနိုင်ပါတယ်။ ရရှိနိုင်တဲ့ အင်္ဂါရပ်အားလုံးကို ရယူဖို့ <a href="https://huggingface.co/join">huggingface.co account တစ်ခု ဖန်တီးပါ</a>!</p></blockquote> <p data-svelte-h="svelte-u8vte3">Transformer မော်ဒယ်တွေ ဘယ်လိုအလုပ်လုပ်လဲဆိုတာကို အသေးစိတ် မလေ့လာခင်မှာ စိတ်ဝင်စားစရာကောင်းတဲ့ NLP ပြဿနာအချို့ကို ဖြေရှင်းဖို့ ဘယ်လိုအသုံးပြုနိုင်လဲဆိုတာကို ဥပမာအချို့နဲ့ ကြည့်ရအောင်။</p> <h2 class="relative group"><a id="working-with-pipelines" 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-pipelines"><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>Pipelines တွေနဲ့ အလုပ်လုပ်ခြင်း</span></h2> <iframe class="w-full xl:w-4/6 h-80" src="https://www.youtube-nocookie.com/embed/tiZFewofSLM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <p data-svelte-h="svelte-acpl7t">🤗 Transformers library ရဲ့ အခြေခံအကျဆုံး object ကတော့ <code>pipeline()</code> function ဖြစ်ပါတယ်။ ၎င်းက မော်ဒယ်တစ်ခုကို ၎င်းရဲ့ လိုအပ်တဲ့ preprocessing နဲ့ postprocessing အဆင့်တွေနဲ့ ချိတ်ဆက်ပေးပြီး ကျွန်တော်တို့ စာသားတစ်ခုခုကို တိုက်ရိုက်ထည့်သွင်းပြီး နားလည်လွယ်တဲ့ အဖြေတစ်ခု ရယူနိုင်စေပါတယ်။</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> pipeline | |
| classifier = pipeline(<span class="hljs-string">"sentiment-analysis"</span>) | |
| classifier(<span class="hljs-string">"I've been waiting for a HuggingFace course my whole life."</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">'label'</span>: <span class="hljs-string">'POSITIVE'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9598047137260437</span>}]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-rq8a7u">ကျွန်တော်တို့ စာကြောင်းများစွာကိုတောင် ပေးပို့နိုင်ပါတယ်။</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 -->classifier( | |
| [<span class="hljs-string">"I've been waiting for a HuggingFace course my whole life."</span>, <span class="hljs-string">"I hate this so much!"</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">'label'</span>: <span class="hljs-string">'POSITIVE'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9598047137260437</span>}, | |
| {<span class="hljs-string">'label'</span>: <span class="hljs-string">'NEGATIVE'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9994558095932007</span>}]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-whde1f">ပုံမှန်အားဖြင့် ဒီ pipeline ဟာ အင်္ဂလိပ်ဘာသာစကားမှာ sentiment analysis အတွက် fine-tune လုပ်ထားတဲ့ သီးခြား pretrained model တစ်ခုကို ရွေးချယ်ပေးပါတယ်။ <code>classifier</code> object ကို ဖန်တီးတဲ့အခါ မော်ဒယ်ကို download လုပ်ပြီး cache လုပ်ထားပါတယ်။ ဒီ command ကို ထပ် run တဲ့အခါ cache လုပ်ထားတဲ့ မော်ဒယ်ကို ပြန်သုံးမှာဖြစ်ပြီး မော်ဒယ်ကို ထပ် download လုပ်ဖို့ မလိုအပ်တော့ပါဘူး။</p> <p data-svelte-h="svelte-1pkwrjp">pipeline ထဲကို စာသားအချို့ ပေးပို့တဲ့အခါ အဓိက အဆင့်သုံးဆင့် ပါဝင်ပါတယ်။</p> <ol data-svelte-h="svelte-yiuxao"><li>စာသားကို မော်ဒယ် နားလည်နိုင်တဲ့ ပုံစံအဖြစ် preprocessing လုပ်ပါတယ်။</li> <li>preprocessing လုပ်ထားတဲ့ inputs တွေကို မော်ဒယ်ဆီ ပေးပို့ပါတယ်။</li> <li>မော်ဒယ်ရဲ့ ခန့်မှန်းချက်တွေကို post-processing လုပ်ပြီး နားလည်လွယ်အောင် ပြန်ထုတ်ပေးပါတယ်။</li></ol> <h2 class="relative group"><a id="မတညသ-နယပယမအတက-ရနငသ-pipelines-မ" 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="#မတညသ-နယပယမအတက-ရနငသ-pipelines-မ"><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>မတူညီသော နယ်ပယ်များအတွက် ရနိုင်သော pipelines များ</span></h2> <p data-svelte-h="svelte-13aqhiu">The <code>pipeline()</code> function ဟာ မတူညီတဲ့ နယ်ပယ်များစွာ (multimodal) ကို ထောက်ပံ့ပေးပြီး စာသား၊ ပုံရိပ်၊ အသံနဲ့ multimodal လုပ်ငန်းတာဝန်တွေအထိ လုပ်ဆောင်နိုင်ပါတယ်။ ဒီသင်တန်းမှာတော့ စာသားလုပ်ငန်းတာဝန်တွေကို အဓိကထားမှာဖြစ်ပေမယ့် Transformer architecture ရဲ့ အလားအလာကို နားလည်ထားဖို့က အသုံးဝင်တာကြောင့် အကျဉ်းချုပ် ဖော်ပြပေးပါမယ်။</p> <p data-svelte-h="svelte-z7hg8g">အောက်ဖော်ပြပါတို့ကတော့ ရရှိနိုင်တဲ့ အရာတွေရဲ့ အကျဉ်းချုပ် ဖြစ်ပါတယ်။</p> <blockquote class="tip" data-svelte-h="svelte-1wku72h"><p>pipelines တွေရဲ့ ပြည့်စုံပြီး နောက်ဆုံးပေါ် စာရင်းအတွက် <a href="https://huggingface.co/docs/hub/en/models-tasks" rel="nofollow">🤗 Transformers documentation</a> ကို ကြည့်ရှုပါ။</p></blockquote> <h3 class="relative group"><a id="စသ-pipelines-text-pipelines" 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="#စသ-pipelines-text-pipelines"><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>စာသား Pipelines (Text pipelines)</span></h3> <ul data-svelte-h="svelte-bktt46"><li><code>text-generation</code>: prompt တစ်ခုမှ စာသားကို ဖန်တီးခြင်း။</li> <li><code>text-classification</code>: စာသားကို ကြိုတင်သတ်မှတ်ထားသော အမျိုးအစားများအဖြစ် ခွဲခြားခြင်း။</li> <li><code>summarization</code>: အဓိက အချက်အလက်များကို ထိန်းသိမ်းထားရင်း စာသားတစ်ခုကို ပိုမိုတိုတောင်းသော ပုံစံအဖြစ် ပြုလုပ်ခြင်း။</li> <li><code>translation</code>: စာသားတစ်ခုကို ဘာသာစကားတစ်ခုမှ အခြားဘာသာစကားတစ်ခုသို့ ဘာသာပြန်ခြင်း။</li> <li><code>zero-shot-classification</code>: သီးခြား label များပေါ်တွင် ကြိုတင်လေ့ကျင့်မှုမရှိဘဲ စာသားကို အမျိုးအစားခွဲခြားခြင်း။(Classify text without prior training on specific labels)</li> <li><code>feature-extraction</code>: စာသားများ၏ vector representations များကို ထုတ်ယူခြင်း။</li></ul> <h3 class="relative group"><a id="ပရပ-pipelines-image-pipelines" 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="#ပရပ-pipelines-image-pipelines"><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>ပုံရိပ် Pipelines (Image pipelines)</span></h3> <ul data-svelte-h="svelte-1a6et0g"><li><code>image-to-text</code>: ပုံရိပ်များ၏ စာသားဖော်ပြချက်များကို ဖန်တီးခြင်း။</li> <li><code>image-classification</code>: ပုံရိပ်တစ်ခုရှိ အရာဝတ္ထုများကို ခွဲခြားသတ်မှတ်ခြင်း။</li> <li><code>object-detection</code>: ပုံရိပ်များရှိ အရာဝတ္ထုများကို နေရာရှာပြီး ခွဲခြားသတ်မှတ်ခြင်း။</li></ul> <h3 class="relative group"><a id="အသ-pipelines-audio-pipelines" 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="#အသ-pipelines-audio-pipelines"><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>အသံ Pipelines (Audio pipelines)</span></h3> <ul data-svelte-h="svelte-kf9wfh"><li><code>automatic-speech-recognition</code>: စကားပြောကို စာသားအဖြစ် ပြောင်းလဲခြင်း။</li> <li><code>audio-classification</code>: အသံများကို အမျိုးအစားများအဖြစ် ခွဲခြားခြင်း။</li> <li><code>text-to-speech</code>: စာသားကို ပြောဆိုသောအသံအဖြစ် ပြောင်းလဲခြင်း။</li></ul> <h3 class="relative group"><a id="multimodal-pipelines" 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="#multimodal-pipelines"><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>Multimodal pipelines</span></h3> <ul data-svelte-h="svelte-3oqd3p"><li><code>image-text-to-text</code>: စာသား prompt တစ်ခုအပေါ် အခြေခံပြီး ပုံရိပ်တစ်ခုကို တုံ့ပြန်ခြင်း။</li></ul> <p data-svelte-h="svelte-lb3nqo">ဒီ pipelines အချို့ကို ပိုမိုအသေးစိတ် လေ့လာကြည့်ရအောင်။</p> <h2 class="relative group"><a id="zero-shot-classification" 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="#zero-shot-classification"><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>Zero-shot classification</span></h2> <p data-svelte-h="svelte-7c24me">ကျွန်တော်တို့ စိန်ခေါ်မှု ပိုများတဲ့ လုပ်ငန်းတာဝန်တစ်ခုနဲ့ စတင်ပါမယ်။ အဲဒါကတော့ label မတပ်ရသေးတဲ့ စာသားတွေကို အမျိုးအစားခွဲခြားဖို့ လိုအပ်တဲ့ အလုပ်ပါ။ ဒါဟာ လက်တွေ့ကမ္ဘာ project တွေမှာ အဖြစ်များတဲ့ အခြေအနေတစ်ခုပါ။ ဘာလို့လဲဆိုတော့ စာသားတွေကို label တပ်ဖို့က အချိန်ကုန်လေ့ရှိပြီး နယ်ပယ်ဆိုင်ရာ ကျွမ်းကျင်မှု (domain expertise) လိုအပ်လို့ပါ။ ဒီလိုကိစ္စမျိုးအတွက် <code>zero-shot-classification</code> pipeline က အလွန်အစွမ်းထက်ပါတယ်။ ၎င်းက classification အတွက် အသုံးပြုရမယ့် labels တွေကို သတ်မှတ်နိုင်စေတာကြောင့် pretrained model ရဲ့ labels တွေကို အားကိုးစရာ မလိုတော့ပါဘူး။ မော်ဒယ်က စာကြောင်းတစ်ကြောင်းကို positive သို့မဟုတ် negative လို့ ဘယ်လိုခွဲခြားနိုင်လဲဆိုတာ သင်မြင်ပြီးပါပြီ — ဒါပေမယ့် သင်လိုချင်တဲ့ အခြား labels အစုအဝေးနဲ့လည်း စာသားကို ခွဲခြားနိုင်ပါသေးတယ်။</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> pipeline | |
| classifier = pipeline(<span class="hljs-string">"zero-shot-classification"</span>) | |
| classifier( | |
| <span class="hljs-string">"This is a course about the Transformers library"</span>, | |
| candidate_labels=[<span class="hljs-string">"education"</span>, <span class="hljs-string">"politics"</span>, <span class="hljs-string">"business"</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">'sequence'</span>: <span class="hljs-string">'This is a course about the Transformers library'</span>, | |
| <span class="hljs-string">'labels'</span>: [<span class="hljs-string">'education'</span>, <span class="hljs-string">'business'</span>, <span class="hljs-string">'politics'</span>], | |
| <span class="hljs-string">'scores'</span>: [<span class="hljs-number">0.8445963859558105</span>, <span class="hljs-number">0.111976258456707</span>, <span class="hljs-number">0.043427448719739914</span>]}<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-c82az1">ဒီ pipeline ကို <em>zero-shot</em> လို့ခေါ်တာကတော့ သင်ရဲ့ဒေတာပေါ်မှာ မော်ဒယ်ကို fine-tune လုပ်ဖို့ မလိုအပ်ဘဲ အသုံးပြုနိုင်လို့ပါ။ ဒါဟာ သင်လိုချင်တဲ့ labels စာရင်းအတွက် ဖြစ်နိုင်ခြေရမှတ် (probability scores) တွေကို တိုက်ရိုက်ပြန်ပေးနိုင်ပါတယ်။</p> <blockquote class="tip" data-svelte-h="svelte-1xti719"><p>✏️ <strong>ကိုယ်တိုင် စမ်းကြည့်ပါဦး။</strong> သင်ရဲ့ ကိုယ်ပိုင် sequences နဲ့ labels တွေနဲ့ စမ်းသပ်ပြီး မော်ဒယ် ဘယ်လို အလုပ်လုပ်လဲ ကြည့်ပါ။</p></blockquote> <h2 class="relative group"><a id="text-generation" 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="#text-generation"><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>စာသား ဖန်တီးခြင်း (Text generation)</span></h2> <p data-svelte-h="svelte-1fx23yd">အခုတော့ စာသားအချို့ ဖန်တီးဖို့ pipeline ကို ဘယ်လိုအသုံးပြုလဲဆိုတာ ကြည့်ရအောင်။ ဒီနေရာမှာ အဓိကစိတ်ကူးက သင် prompt တစ်ခု ပေးလိုက်ရင် မော်ဒယ်က ကျန်ရှိတဲ့ စာသားကို ဖန်တီးပေးခြင်းဖြင့် auto-complete လုပ်ပေးပါလိမ့်မယ်။ ဒါက ဖုန်းတွေမှာ တွေ့ရတဲ့ predictive text feature နဲ့ ဆင်တူပါတယ်။ စာသားဖန်တီးခြင်းမှာ randomness ပါဝင်တာကြောင့် အောက်မှာ ပြထားတဲ့ ရလဒ်တွေအတိုင်း အတိအကျမရရင်လည်း ပုံမှန်ပါပဲ။</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> pipeline | |
| generator = pipeline(<span class="hljs-string">"text-generation"</span>) | |
| generator(<span class="hljs-string">"In this course, we will teach you how to"</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">'generated_text'</span>: <span class="hljs-string">'In this course, we will teach you how to understand and use '</span> | |
| <span class="hljs-string">'data flow and data interchange when handling user data. We '</span> | |
| <span class="hljs-string">'will be working with one or more of the most commonly used '</span> | |
| <span class="hljs-string">'data flows — data flows of various types, as seen by the '</span> | |
| <span class="hljs-string">'HTTP'</span>}]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-ffn4oc"><code>num_return_sequences</code> argument နဲ့ ဖန်တီးမယ့် sequence အရေအတွက်ကို ထိန်းချုပ်နိုင်ပြီး <code>max_length</code> argument နဲ့ ထွက်ပေါ်လာမယ့် စာသားရဲ့ စုစုပေါင်းအရှည်ကို ထိန်းချုပ်နိုင်ပါတယ်။</p> <blockquote class="tip" data-svelte-h="svelte-16y06zy"><p>✏️ <strong>ကိုယ်တိုင် စမ်းကြည့်ပါဦး။</strong> <code>num_return_sequences</code> နဲ့ <code>max_length</code> arguments တွေကို အသုံးပြုပြီး စကားလုံး ၁၅ လုံးစီ ပါဝင်တဲ့ စာကြောင်းနှစ်ကြောင်း ဖန်တီးပါ။</p></blockquote> <h2 class="relative group"><a id="using-any-model-from-the-hub-in-a-pipeline" 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="#using-any-model-from-the-hub-in-a-pipeline"><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>Hub မှ မည်သည့်မော်ဒယ်ကိုမဆို pipeline ထဲတွင် အသုံးပြုခြင်း</span></h2> <p data-svelte-h="svelte-1px18iz">အထက်ပါ ဥပမာတွေမှာတော့ လုပ်ငန်းတာဝန်အတွက် ပုံမှန်မော်ဒယ်ကို အသုံးပြုခဲ့တာဖြစ်ပေမယ့်၊ သီးခြားလုပ်ငန်းတစ်ခု — ဥပမာ စာသားဖန်တီးခြင်းအတွက် Hub ကနေ သီးခြားမော်ဒယ်တစ်ခုကိုလည်း pipeline ထဲမှာ ရွေးချယ်အသုံးပြုနိုင်ပါတယ်။ <a href="https://huggingface.co/models" rel="nofollow">Model Hub</a> ကိုသွားပြီး ဘယ်ဘက်ခြမ်းမှာရှိတဲ့ သက်ဆိုင်ရာ tag ကို နှိပ်လိုက်ရင် အဲဒီလုပ်ငန်းအတွက် ထောက်ပံ့ပေးတဲ့ မော်ဒယ်တွေကိုသာ ပြသပေးပါလိမ့်မယ်။ <a href="https://huggingface.co/models?pipeline_tag=text-generation" rel="nofollow">ဒီစာမျက်နှာ</a> လို စာမျက်နှာကို သင်ရောက်သွားပါလိမ့်မယ်။</p> <p data-svelte-h="svelte-toubtz"><a href="https://huggingface.co/HuggingFaceTB/SmolLM2-360M" rel="nofollow"><code>HuggingFaceTB/SmolLM2-360M</code></a> မော်ဒယ်ကို စမ်းကြည့်ရအောင်။ အောက်ပါအတိုင်း အရင်ကအတိုင်း pipeline ထဲမှာ ထည့်သွင်း 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> transformers <span class="hljs-keyword">import</span> pipeline | |
| generator = pipeline(<span class="hljs-string">"text-generation"</span>, model=<span class="hljs-string">"HuggingFaceTB/SmolLM2-360M"</span>) | |
| generator( | |
| <span class="hljs-string">"In this course, we will teach you how to"</span>, | |
| max_length=<span class="hljs-number">30</span>, | |
| num_return_sequences=<span class="hljs-number">2</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">'generated_text'</span>: <span class="hljs-string">'In this course, we will teach you how to manipulate the world and '</span> | |
| <span class="hljs-string">'move your mental and physical capabilities to your advantage.'</span>}, | |
| {<span class="hljs-string">'generated_text'</span>: <span class="hljs-string">'In this course, we will teach you how to become an expert and '</span> | |
| <span class="hljs-string">'practice realtime, and with a hands on experience on both real '</span> | |
| <span class="hljs-string">'time and real'</span>}]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-16dp8fc">ဘာသာစကား tags တွေကို နှိပ်ပြီး သင်ရဲ့မော်ဒယ်ရှာဖွေမှုကို ပိုမိုတိကျအောင် လုပ်ဆောင်နိုင်ပြီး အခြားဘာသာစကားနဲ့ စာသားဖန်တီးပေးမယ့် မော်ဒယ်တစ်ခုကို ရွေးချယ်နိုင်ပါတယ်။ Model Hub မှာ ဘာသာစကားမျိုးစုံကို ထောက်ပံ့ပေးတဲ့ multilingual model တွေအတွက် checkpoints တွေလည်း ပါဝင်ပါတယ်။</p> <p data-svelte-h="svelte-1esat90">မော်ဒယ်တစ်ခုကို နှိပ်ပြီး ရွေးချယ်လိုက်တာနဲ့ ၎င်းကို တိုက်ရိုက် online မှာ စမ်းသပ်နိုင်တဲ့ widget တစ်ခုကို တွေ့ရပါလိမ့်မယ်။ ဒီနည်းနဲ့ မော်ဒယ်ကို download မလုပ်ခင်မှာ ၎င်းရဲ့စွမ်းဆောင်ရည်တွေကို အမြန်စမ်းသပ်နိုင်ပါတယ်။</p> <blockquote class="tip" data-svelte-h="svelte-1fj9z6y"><p>✏️ <strong>ကိုယ်တိုင် စမ်းကြည့်ပါဦး။</strong> အခြားဘာသာစကားတစ်ခုအတွက် text generation မော်ဒယ်တစ်ခုကို ရှာဖွေဖို့ filters တွေကို အသုံးပြုပါ။ widget နဲ့ စမ်းသပ်ပြီး pipeline ထဲမှာ အသုံးပြုနိုင်ပါတယ်။</p></blockquote> <h3 class="relative group"><a id="inference-providers" 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="#inference-providers"><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>Inference Providers များ</span></h3> <p data-svelte-h="svelte-1ykl9v6">မော်ဒယ်အားလုံးကို Hugging Face <a href="https://huggingface.co/docs/inference-providers/en/index" rel="nofollow">website</a> မှာ ရရှိနိုင်တဲ့ Inference Providers ကို အသုံးပြုပြီး သင့် browser ကနေ တိုက်ရိုက် စမ်းသပ်နိုင်ပါတယ်။ ဒီစာမျက်နှာမှာ စိတ်ကြိုက်စာသားထည့်သွင်းပြီး မော်ဒယ်က input data ကို ဘယ်လိုလုပ်ဆောင်လဲဆိုတာကို ကြည့်ရှုခြင်းဖြင့် မော်ဒယ်နဲ့ တိုက်ရိုက်ကစားနိုင်ပါတယ်။</p> <p data-svelte-h="svelte-ofcers">Widget ကို စွမ်းဆောင်ပေးတဲ့ Inference Providers ကိုလည်း ငွေပေးချေရတဲ့ ထုတ်ကုန်အဖြစ် ရရှိနိုင်ပါတယ်။ ဒါက သင်ရဲ့ workflow တွေအတွက် လိုအပ်ရင် အလွန်အသုံးဝင်ပါတယ်။ အသေးစိတ်အတွက်<a href="https://huggingface.co/docs/inference-providers/en/pricing" rel="nofollow">pricing page</a> ကို ကြည့်ပါ။</p> <h2 class="relative group"><a id="mask-filling" 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="#mask-filling"><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>Mask filling</span></h2> <p data-svelte-h="svelte-13jg2cp">သင်စမ်းသပ်ရမယ့် နောက်ထပ် pipeline ကတော့ <code>fill-mask</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> pipeline | |
| unmasker = pipeline(<span class="hljs-string">"fill-mask"</span>) | |
| unmasker(<span class="hljs-string">"This course will teach you all about <mask> models."</span>, top_k=<span class="hljs-number">2</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">'sequence'</span>: <span class="hljs-string">'This course will teach you all about mathematical models.'</span>, | |
| <span class="hljs-string">'score'</span>: <span class="hljs-number">0.19619831442832947</span>, | |
| <span class="hljs-string">'token'</span>: <span class="hljs-number">30412</span>, | |
| <span class="hljs-string">'token_str'</span>: <span class="hljs-string">' mathematical'</span>}, | |
| {<span class="hljs-string">'sequence'</span>: <span class="hljs-string">'This course will teach you all about computational models.'</span>, | |
| <span class="hljs-string">'score'</span>: <span class="hljs-number">0.04052725434303284</span>, | |
| <span class="hljs-string">'token'</span>: <span class="hljs-number">38163</span>, | |
| <span class="hljs-string">'token_str'</span>: <span class="hljs-string">' computational'</span>}]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-12kse2s"><code>top_k</code> argument က သင်ပြသ၊လိုတဲ့ ဖြစ်နိုင်ခြေ အရေအတွက်ကို ထိန်းချုပ်ပါတယ်။ ဒီနေရာမှာ မော်ဒယ်က <code><mask></code> ဆိုတဲ့ အထူးစကားလုံးကို ဖြည့်ပေးတာကို သတိပြုပါ။ ဒါကို <em>mask token</em> လို့ မကြာခဏ ရည်ညွှန်းလေ့ရှိပါတယ်။ အခြား mask-filling မော်ဒယ်တွေမှာ မတူညီတဲ့ mask token တွေ ရှိနိုင်တာကြောင့် အခြားမော်ဒယ်တွေကို လေ့လာတဲ့အခါ မှန်ကန်တဲ့ mask word ကို အမြဲစစ်ဆေးတာ ကောင်းပါတယ်။ စစ်ဆေးဖို့ နည်းလမ်းတစ်ခုကတော့ widget မှာ အသုံးပြုထားတဲ့ mask word ကို ကြည့်တာပါပဲ။</p> <blockquote class="tip" data-svelte-h="svelte-15snhs"><p>✏️ <strong>ကိုယ်တိုင် စမ်းကြည့်ပါဦး။</strong> Hub ပေါ်မှာ <code>bert-base-cased</code> မော်ဒယ်ကို ရှာဖွေပြီး Inference API widget မှာ ၎င်းရဲ့ mask word ကို ခွဲခြားသတ်မှတ်ပါ။ ကျွန်တော်တို့ရဲ့ <code>pipeline</code> ဥပမာမှာပါတဲ့ စာကြောင်းအတွက် ဒီမော်ဒယ်က ဘာကို ခန့်မှန်းပေးမလဲ။</p></blockquote> <h2 class="relative group"><a id="named-entity-recognition" 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="#named-entity-recognition"><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>Named entity recognition</span></h2> <p data-svelte-h="svelte-1vl3tg3">Named Entity Recognition (NER) ဆိုတာက input text ထဲက ဘယ်အပိုင်းတွေက လူ၊ နေရာ ဒါမှမဟုတ် အဖွဲ့အစည်းလို entities တွေနဲ့ ကိုက်ညီလဲဆိုတာကို မော်ဒယ်က ရှာဖွေရတဲ့ လုပ်ငန်းတာဝန်တစ်ခု ဖြစ်ပါတယ်။ ဥပမာတစ်ခုကို ကြည့်ရအောင်။</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> pipeline | |
| ner = pipeline(<span class="hljs-string">"ner"</span>, grouped_entities=<span class="hljs-literal">True</span>) | |
| ner(<span class="hljs-string">"My name is Sylvain and I work at Hugging Face in Brooklyn."</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">'entity_group'</span>: <span class="hljs-string">'PER'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.99816</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'Sylvain'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">11</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">18</span>}, | |
| {<span class="hljs-string">'entity_group'</span>: <span class="hljs-string">'ORG'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.97960</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'Hugging Face'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">33</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">45</span>}, | |
| {<span class="hljs-string">'entity_group'</span>: <span class="hljs-string">'LOC'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.99321</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'Brooklyn'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">49</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">57</span>} | |
| ]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-wq6m98">ဒီနေရာမှာ မော်ဒယ်က Sylvain ဟာ လူ (PER) ဖြစ်ကြောင်း၊ Hugging Face က အဖွဲ့အစည်း (ORG) ဖြစ်ကြောင်း၊ Brooklyn က နေရာ (LOC) ဖြစ်ကြောင်း မှန်ကန်စွာ ဖော်ထုတ်ခဲ့ပါတယ်။</p> <p data-svelte-h="svelte-7efgp0">ကျွန်တော်တို့ <code>grouped_entities=True option</code> ကို pipeline ဖန်တီးတဲ့ function မှာ ပေးလိုက်တာက စာကြောင်းရဲ့ အစိတ်အပိုင်းတွေကို တူညီတဲ့ entity နဲ့ ကိုက်ညီတဲ့ အစိတ်အပိုင်းတွေကို အတူတကွ ပြန်လည်စုစည်းဖို့ pipeline ကို ပြောတာပါ။ ဒီနေရာမှာ မော်ဒယ်က “Hugging” နဲ့ “Face” ကို စကားလုံးများစွာနဲ့ ဖွဲ့စည်းထားတဲ့ နာမည်ဖြစ်ပေမယ့် တစ်ခုတည်းသော အဖွဲ့အစည်းအဖြစ် မှန်ကန်စွာ စုစည်းခဲ့ပါတယ်။ တကယ်တော့ နောက်အခန်းမှာ ကျွန်တော်တို့ မြင်ရမှာဖြစ်သလို preprocessing က စကားလုံးအချို့ကို ပိုမိုသေးငယ်တဲ့ အစိတ်အပိုင်းတွေအဖြစ် ခွဲထုတ်တာတောင် လုပ်ပါတယ်။ ဥပမာ၊ <code>Sylvain</code> ကို <code>S</code>၊ <code>##yl</code>၊ <code>##va</code>၊ <code>##in</code> ဆိုပြီး လေးပိုင်းခွဲပါတယ်။ post-processing အဆင့်မှာတော့ pipeline က အဲဒီအပိုင်းတွေကို အောင်မြင်စွာ ပြန်လည်စုစည်းပေးပါတယ်။</p> <blockquote class="tip" data-svelte-h="svelte-11uz624"><p>✏️ <strong>ကိုယ်တိုင် စမ်းကြည့်ပါဦး။</strong> Model Hub မှာ အင်္ဂလိပ်ဘာသာစကားမှာ part-of-speech tagging (အတိုကောက်အားဖြင့် POS) လုပ်ဆောင်နိုင်တဲ့ မော်ဒယ်တစ်ခုကို ရှာဖွေပါ။ အထက်ပါ ဥပမာမှာပါတဲ့ စာကြောင်းအတွက် ဒီမော်ဒယ်က ဘာကို ခန့်မှန်းပေးမလဲ။</p></blockquote> <h2 class="relative group"><a id="question-answering" 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="#question-answering"><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>မေးခွန်းဖြေဆိုခြင်း (Question answering)</span></h2> <p data-svelte-h="svelte-1xlrgc9"><code>question-answering</code> pipeline ကတော့ ပေးထားတဲ့ အကြောင်းအရာတစ်ခုကနေ အချက်အလက်တွေကို အသုံးပြုပြီး မေးခွန်းတွေကို ဖြေပေးပါတယ်။</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> pipeline | |
| question_answerer = pipeline(<span class="hljs-string">"question-answering"</span>) | |
| question_answerer( | |
| question=<span class="hljs-string">"Where do I work?"</span>, | |
| context=<span class="hljs-string">"My name is Sylvain and I work at Hugging Face in Brooklyn"</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">'score'</span>: <span class="hljs-number">0.6385916471481323</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">33</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">45</span>, <span class="hljs-string">'answer'</span>: <span class="hljs-string">'Hugging Face'</span>}<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-bpm47i">ဒီ pipeline က ပေးထားတဲ့ context ကနေ အချက်အလက်တွေကို ထုတ်ယူပြီး အလုပ်လုပ်တာကို သတိပြုပါ။ ၎င်းက အဖြေကို ဖန်တီးပေးတာ မဟုတ်ပါဘူး။</p> <h2 class="relative group"><a id="summarization" 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="#summarization"><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>အနှစ်ချုပ်ခြင်း(Summarization)</span></h2> <p data-svelte-h="svelte-141uyrj">Summarization ဆိုတာက စာသားတစ်ခုကို ပိုမိုတိုတောင်းတဲ့ စာသားတစ်ခုအဖြစ် လျှော့ချပြီး စာသားမှာ ရည်ညွှန်းထားတဲ့ အရေးကြီးတဲ့ အချက်အလက်အားလုံး (သို့မဟုတ် အများစု) ကို ထိန်းသိမ်းထားတဲ့ လုပ်ငန်းတာဝန် ဖြစ်ပါတယ်။ ဥပမာတစ်ခုကို ကြည့်ရအောင်။</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> pipeline | |
| summarizer = pipeline(<span class="hljs-string">"summarization"</span>) | |
| summarizer( | |
| <span class="hljs-string">""" | |
| America has changed dramatically during recent years. Not only has the number of | |
| graduates in traditional engineering disciplines such as mechanical, civil, | |
| electrical, chemical, and aeronautical engineering declined, but in most of | |
| the premier American universities engineering curricula now concentrate on | |
| and encourage largely the study of engineering science. As a result, there | |
| are declining offerings in engineering subjects dealing with infrastructure, | |
| the environment, and related issues, and greater concentration on high | |
| technology subjects, largely supporting increasingly complex scientific | |
| developments. While the latter is important, it should not be at the expense | |
| of more traditional engineering. | |
| Rapidly developing economies such as China and India, as well as other | |
| industrial countries in Europe and Asia, continue to encourage and advance | |
| the teaching of engineering. Both China and India, respectively, graduate | |
| six and eight times as many traditional engineers as does the United States. | |
| Other industrial countries at minimum maintain their output, while America | |
| suffers an increasingly serious decline in the number of engineering graduates | |
| and a lack of well-educated engineers. | |
| """</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">'summary_text'</span>: <span class="hljs-string">' America has changed dramatically during recent years . The '</span> | |
| <span class="hljs-string">'number of engineering graduates in the U.S. has declined in '</span> | |
| <span class="hljs-string">'traditional engineering disciplines such as mechanical, civil '</span> | |
| <span class="hljs-string">', electrical, chemical, and aeronautical engineering . Rapidly '</span> | |
| <span class="hljs-string">'developing economies such as China and India, as well as other '</span> | |
| <span class="hljs-string">'industrial countries in Europe and Asia, continue to encourage '</span> | |
| <span class="hljs-string">'and advance engineering .'</span>}]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-phg2jj">Text generation နဲ့ အလားတူပဲ၊ ရလဒ်အတွက် <code>max_length</code> သို့မဟုတ် <code>min_length</code> ကို သတ်မှတ်နိုင်ပါတယ်။</p> <h2 class="relative group"><a id="translation" 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="#translation"><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>ဘာသာပြန်ခြင်း (Translation)</span></h2> <p data-svelte-h="svelte-1aiiar6">ဘာသာပြန်ခြင်းအတွက်တော့ လုပ်ငန်းတာဝန်အမည်မှာ ဘာသာစကားတွဲ (ဥပမာ- <code>"translation_en_to_fr"</code>) ကို ပေးလိုက်ရင် default မော်ဒယ်ကို အသုံးပြုနိုင်ပါတယ်။ ဒါပေမယ့် အလွယ်ကူဆုံးနည်းလမ်းကတော့ <a href="https://huggingface.co/models" rel="nofollow">Model Hub</a> ကနေ သင်အသုံးပြုလိုတဲ့ မော်ဒယ်ကို ရွေးချယ်တာပါပဲ။ ဒီနေရာမှာတော့ ပြင်သစ်ဘာသာကနေ အင်္ဂလိပ်ဘာသာကို ဘာသာပြန်ကြည့်ပါမယ်။</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> pipeline | |
| translator = pipeline(<span class="hljs-string">"translation"</span>, model=<span class="hljs-string">"Helsinki-NLP/opus-mt-fr-en"</span>) | |
| translator(<span class="hljs-string">"Ce cours est produit par Hugging Face."</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">'translation_text'</span>: <span class="hljs-string">'This course is produced by Hugging Face.'</span>}]<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1i61991">Text generation နဲ့ summarization တွေလိုပဲ ရလဒ်အတွက် <code>max_length</code> သို့မဟုတ် <code>min_length</code> ကို သတ်မှတ်နိုင်ပါတယ်။</p> <blockquote class="tip" data-svelte-h="svelte-14re915"><p>✏️ <strong>ကိုယ်တိုင် စမ်းကြည့်ပါဦး။</strong> အခြားဘာသာစကားတွေမှာ ဘာသာပြန်မော်ဒယ်တွေကို ရှာဖွေပြီး အရင်စာကြောင်းကို မတူညီတဲ့ ဘာသာစကားအချို့ဆီ ဘာသာပြန်ကြည့်ပါ။</p></blockquote> <h2 class="relative group"><a id="ပရပနင-အသ-pipelines-မ-image-and-audio-pipelines" 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="#ပရပနင-အသ-pipelines-မ-image-and-audio-pipelines"><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>ပုံရိပ်နှင့် အသံ Pipelines များ (Image and audio pipelines)</span></h2> <p data-svelte-h="svelte-1i3owyd">စာသားအပြင် Transformer မော်ဒယ်တွေဟာ ပုံရိပ်နဲ့ အသံတွေနဲ့လည်း အလုပ်လုပ်နိုင်ပါတယ်။ ဥပမာအချို့ကတော့-</p> <h3 class="relative group"><a id="image-classification" 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="#image-classification"><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>Image classification</span></h3> <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> pipeline | |
| image_classifier = pipeline( | |
| task=<span class="hljs-string">"image-classification"</span>, model=<span class="hljs-string">"google/vit-base-patch16-224"</span> | |
| ) | |
| result = image_classifier( | |
| <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"</span> | |
| ) | |
| <span class="hljs-built_in">print</span>(result)<!-- 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">'label'</span>: <span class="hljs-string">'lynx, catamount'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.43350091576576233</span>}, | |
| {<span class="hljs-string">'label'</span>: <span class="hljs-string">'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'</span>, | |
| <span class="hljs-string">'score'</span>: <span class="hljs-number">0.034796204417943954</span>}, | |
| {<span class="hljs-string">'label'</span>: <span class="hljs-string">'snow leopard, ounce, Panthera uncia'</span>, | |
| <span class="hljs-string">'score'</span>: <span class="hljs-number">0.03240183740854263</span>}, | |
| {<span class="hljs-string">'label'</span>: <span class="hljs-string">'Egyptian cat'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.02394474856555462</span>}, | |
| {<span class="hljs-string">'label'</span>: <span class="hljs-string">'tiger cat'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.02288915030658245</span>}]<!-- HTML_TAG_END --></pre></div> <h3 class="relative group"><a id="automatic-speech-recognition" 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="#automatic-speech-recognition"><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>Automatic speech recognition</span></h3> <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> pipeline | |
| transcriber = pipeline( | |
| task=<span class="hljs-string">"automatic-speech-recognition"</span>, model=<span class="hljs-string">"openai/whisper-large-v3"</span> | |
| ) | |
| result = transcriber( | |
| <span class="hljs-string">"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac"</span> | |
| ) | |
| <span class="hljs-built_in">print</span>(result)<!-- 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">'text'</span>: <span class="hljs-string">' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'</span>}<!-- HTML_TAG_END --></pre></div> <h2 class="relative group"><a id="ဒတ-အရငအမစမစမ-ဒတမက-ပငစပခင-combining-data-from-multiple-sources" 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="#ဒတ-အရငအမစမစမ-ဒတမက-ပငစပခင-combining-data-from-multiple-sources"><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>ဒေတာ အရင်းအမြစ်မျိုးစုံမှ ဒေတာများကို ပေါင်းစပ်ခြင်း (Combining data from multiple sources)</span></h2> <p data-svelte-h="svelte-14h0h7l">Transformer မော်ဒယ်တွေရဲ့ အစွမ်းထက်တဲ့ အသုံးချမှုတစ်ခုကတော့ ဒေတာအရင်းအမြစ်မျိုးစုံကနေ ဒေတာတွေကို ပေါင်းစပ်ပြီး လုပ်ဆောင်နိုင်စွမ်းပါပဲ။ ဒါက အောက်ပါကိစ္စတွေအတွက် အထူးအသုံးဝင်ပါတယ်။</p> <ol data-svelte-h="svelte-hx29sz"><li>ဒေတာဘေ့စ်(databases)များစွာ သို့မဟုတ် repository များစွာကို ရှာဖွေခြင်း။</li> <li>တူညီတဲ့ format တွေ (စာသား၊ ပုံရိပ်၊ အသံ) ကနေ အချက်အလက်တွေကို စုစည်းခြင်း။</li> <li>ဆက်စပ်အချက်အလက်တွေရဲ့ ပေါင်းစပ်ထားသော မြင်ကွင်းတစ်ခုကို ဖန်တီးခြင်း။</li></ol> <p data-svelte-h="svelte-9fyw7i">ဥပမာအားဖြင့်၊ သင်ဟာ အောက်ပါတို့ကို လုပ်ဆောင်နိုင်တဲ့ စနစ်တစ်ခုကို တည်ဆောက်နိုင်ပါတယ်။</p> <ul data-svelte-h="svelte-19rwer8"><li>စာသားနဲ့ ပုံရိပ်လို နယ်ပယ်အမျိုးစုံက ဒေတာဘေ့စ်တွေမှာ အချက်အလက်တွေကို ရှာဖွေခြင်း။</li> <li>မတူညီတဲ့ အရင်းအမြစ်တွေကနေ ရရှိတဲ့ ရလဒ်တွေကို တစ်ခုတည်းသော တုံ့ပြန်မှုအဖြစ် ပေါင်းစပ်ခြင်း။ ဥပမာ- အသံဖိုင်တစ်ခုနဲ့ စာသားဖော်ပြချက်တစ်ခုကနေ။</li> <li>document တွေနဲ့ metadata တွေရဲ့ ဒေတာဘေ့စ်တစ်ခုကနေ အသက်ဆိုင်ဆုံး အချက်အလက်တွေကို တင်ပြခြင်း။</li></ul> <h2 class="relative group"><a id="နဂခပ" 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="#နဂခပ"><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-13dhwjb">ဒီအခန်းမှာ ပြသထားတဲ့ pipelines တွေကတော့ အများစုက သရုပ်ပြရန်အတွက်သာ ဖြစ်ပါတယ်။ ၎င်းတို့ကို သီးခြားလုပ်ငန်းတာဝန်များအတွက် ရေးဆွဲထားတာဖြစ်ပြီး ၎င်းတို့ရဲ့ မူကွဲတွေကိုတော့ လုပ်ဆောင်နိုင်ခြင်း မရှိပါဘူး။ နောက်အခန်းမှာတော့ <code>pipeline()</code> function ထဲမှာ ဘာတွေပါလဲ၊ ၎င်းရဲ့ လုပ်ဆောင်ပုံကို ဘယ်လိုစိတ်ကြိုက် ပြုပြင်နိုင်လဲဆိုတာကို သင်လေ့လာရမှာ ဖြစ်ပါတယ်။</p> <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-n8l9kb"><li><strong>Transformer Models</strong>: Natural Language Processing (NLP) မှာ အောင်မြင်မှုများစွာရရှိခဲ့တဲ့ deep learning architecture တစ်မျိုးပါ။ ၎င်းတို့ဟာ စာသားတွေထဲက စကားလုံးတွေရဲ့ ဆက်နွယ်မှုတွေကို “attention mechanism” သုံးပြီး နားလည်အောင် သင်ကြားပေးပါတယ်။</li> <li><strong>🤗 Transformers library</strong>: Hugging Face က ထုတ်လုပ်ထားတဲ့ library တစ်ခုဖြစ်ပြီး Transformer မော်ဒယ်တွေကို အသုံးပြုပြီး Natural Language Processing (NLP), computer vision, audio processing စတဲ့ နယ်ပယ်တွေမှာ အဆင့်မြင့် AI မော်ဒယ်တွေကို တည်ဆောက်ပြီး အသုံးပြုနိုင်စေပါတယ်။</li> <li><strong><code>pipeline()</code> function</strong>: Hugging Face Transformers library မှာ ပါဝင်တဲ့ လုပ်ဆောင်ချက်တစ်ခုဖြစ်ပြီး မော်ဒယ်တွေကို သီးခြားလုပ်ငန်းတာဝန်များ (ဥပမာ- စာသားခွဲခြားသတ်မှတ်ခြင်း၊ စာသားထုတ်လုပ်ခြင်း) အတွက် အသုံးပြုရလွယ်ကူအောင် ပြုလုပ်ပေးပါတယ်။</li> <li><strong>Natural Language Processing (NLP)</strong>: ကွန်ပျူတာတွေ လူသားဘာသာစကားကို နားလည်၊ အဓိပ္ပာယ်ဖော်ပြီး၊ ဖန်တီးနိုင်အောင် လုပ်ဆောင်ပေးတဲ့ Artificial Intelligence (AI) ရဲ့ နယ်ပယ်ခွဲတစ်ခု ဖြစ်ပါတယ်။ ဥပမာအားဖြင့် စာသားခွဲခြမ်းစိတ်ဖြာခြင်း၊ ဘာသာပြန်ခြင်း စသည်တို့ ပါဝင်ပါတယ်။</li> <li><strong>Computer Vision</strong>: ကွန်ပျူတာများကို ပုံရိပ်များ၊ ဗီဒီယိုများကို လူသားများကဲ့သို့ မြင်၊ နားလည်နိုင်အောင် သင်ကြားပေးသည့် Artificial Intelligence (AI) နယ်ပယ်။</li> <li><strong>Audio Processing</strong>: အသံအချက်အလက်များကို ခွဲခြမ်းစိတ်ဖြာခြင်း၊ ပြောင်းလဲခြင်း သို့မဟုတ် ဖန်တီးခြင်း လုပ်ငန်းများ။</li> <li><strong>Model Hub</strong>: Hugging Face က ထုတ်လုပ်ထားတဲ့ အွန်လိုင်း platform တစ်ခုဖြစ်ပြီး AI မော်ဒယ်တွေ၊ datasets တွေနဲ့ demo တွေကို အခြားသူတွေနဲ့ မျှဝေဖို့၊ ရှာဖွေဖို့နဲ့ ပြန်လည်အသုံးပြုဖို့အတွက် ဖြစ်ပါတယ်။</li> <li><strong>Pretrained Model</strong>: ကြီးမားသော ဒေတာအစုအဝေးများဖြင့် ကြိုတင်လေ့ကျင့်ထားသော Machine Learning မော်ဒယ်။ ၎င်းတို့ကို အခြားလုပ်ငန်းများအတွက် fine-tune ပြန်လုပ်နိုင်ပါတယ်။</li> <li><strong>Fine-tuned</strong>: ကြိုတင်လေ့ကျင့်ထားပြီးသား (pre-trained) မော်ဒယ်တစ်ခုကို သီးခြားလုပ်ငန်းတစ်ခု (specific task) အတွက် အနည်းငယ်သော ဒေတာနဲ့ ထပ်မံလေ့ကျင့်ပေးခြင်းကို ဆိုလိုပါတယ်။</li> <li><strong>Sentiment Analysis</strong>: စာသားတစ်ခုရဲ့ စိတ်ခံစားမှု (အပြုသဘော၊ အနုတ်သဘော၊ ကြားနေ) ကို ခွဲခြမ်းစိတ်ဖြာခြင်း။</li> <li><strong>Preprocessing</strong>: ဒေတာများကို Machine Learning မော်ဒယ်တစ်ခုက နားလည်နိုင်သော ပုံစံသို့ ပြောင်းလဲရန် ပြင်ဆင်ခြင်းလုပ်ငန်းစဉ်။</li> <li><strong>Postprocessing</strong>: Machine Learning မော်ဒယ်၏ ရလဒ်များကို လူသားများ နားလည်လွယ်သော ပုံစံသို့ ပြန်လည်ပြောင်းလဲခြင်းလုပ်ငန်းစဉ်။</li> <li><strong>Multimodal</strong>: မတူညီသော ဒေတာအမျိုးအစားများ (ဥပမာ- စာသား၊ ပုံရိပ်၊ အသံ) ကို အသုံးပြုနိုင်စွမ်းရှိခြင်း။</li> <li><strong>Text Generation</strong>: AI မော်ဒယ်များကို အသုံးပြု၍ လူသားကဲ့သို့သော စာသားအသစ်များ ဖန်တီးခြင်း။</li> <li><strong>Text Classification</strong>: စာသားတစ်ခုကို ကြိုတင်သတ်မှတ်ထားသော အမျိုးအစားများအဖြစ် ခွဲခြားခြင်း။</li> <li><strong>Summarization</strong>: အဓိက အချက်အလက်များကို ထိန်းသိမ်းထားရင်း စာသားတစ်ခုကို ပိုမိုတိုတောင်းသော ပုံစံအဖြစ် ပြုလုပ်ခြင်း။</li> <li><strong>Translation</strong>: စာသားတစ်ခုကို ဘာသာစကားတစ်ခုမှ အခြားဘာသာစကားတစ်ခုသို့ ဘာသာပြန်ခြင်း။</li> <li><strong>Zero-shot Classification</strong>: သီးခြား label များပေါ်တွင် ကြိုတင်လေ့ကျင့်မှုမရှိဘဲ စာသားကို အမျိုးအစားခွဲခြားခြင်း။</li> <li><strong>Feature Extraction</strong>: ဒေတာများမှ အရေးကြီးသော လက္ခဏာရပ်များကို ထုတ်ယူခြင်း။</li> <li><strong>Image to Text</strong>: ပုံရိပ်တစ်ခုမှ စာသားဖော်ပြချက်များကို ဖန်တီးခြင်း။</li> <li><strong>Image Classification</strong>: ပုံရိပ်တစ်ခုရှိ အရာဝတ္ထုများကို ခွဲခြားသတ်မှတ်ခြင်း။</li> <li><strong>Object Detection</strong>: ပုံရိပ်များရှိ အရာဝတ္ထုများကို နေရာရှာပြီး ခွဲခြားသတ်မှတ်ခြင်း။</li> <li><strong>Automatic Speech Recognition</strong>: ပြောဆိုသော ဘာသာစကားကို ကွန်ပျူတာက စာသားအဖြစ် ပြောင်းလဲနားလည်နိုင်သည့် နည်းပညာ။</li> <li><strong>Audio Classification</strong>: အသံများကို အမျိုးအစားများအဖြစ် ခွဲခြားခြင်း။</li> <li><strong>Text to Speech</strong>: စာသားကို ပြောဆိုသောအသံအဖြစ် ပြောင်းလဲခြင်း။</li> <li><strong>Image-Text to Text</strong>: ပုံရိပ်တစ်ခုနဲ့ ပတ်သက်ပြီး စာသား prompt တစ်ခုအပေါ် အခြေခံပြီး စာသားတုံ့ပြန်မှု ဖန်တီးခြင်း။</li> <li><strong>Label</strong>: ဒေတာအချက်အလက်တစ်ခုကို ဖော်ပြရန် အသုံးပြုသော အမည် သို့မဟုတ် အမျိုးအစား။</li> <li><strong>Domain Expertise</strong>: သီးခြားနယ်ပယ်တစ်ခု သို့မဟုတ် ဘာသာရပ်တစ်ခုတွင် နက်ရှိုင်းသော အသိပညာ သို့မဟုတ် ကျွမ်းကျင်မှု။</li> <li><strong>Prompt</strong>: Large Language Models (LLMs) ကို တိကျသောလုပ်ငန်းတစ်ခု လုပ်ဆောင်ရန် သို့မဟုတ် အချက်အလက်ပေးရန်အတွက် ပေးပို့သော input text သို့မဟုတ် မေးခွန်း။</li> <li><strong>Randomness</strong>: ကြိုတင်ခန့်မှန်းနိုင်ခြင်းမရှိသော သို့မဟုတ် အစီအစဉ်မရှိသော အခြေအနေများ။</li> <li><strong><code>num_return_sequences</code></strong>: text generation pipeline တွင် ဖန်တီးမည့် output sequence အရေအတွက်ကို ထိန်းချုပ်ရန် အသုံးပြုသော argument။</li> <li><strong><code>max_length</code></strong>: text generation pipeline တွင် ထွက်ပေါ်လာမည့် output text ၏ အရှည်ဆုံး ဖြစ်နိုင်သော အရှည်ကို သတ်မှတ်ရန် အသုံးပြုသော argument။</li> <li><strong>Inference Providers</strong>: Hugging Face Hub ပေါ်ရှိ မော်ဒယ်များကို cloud-based API မှတစ်ဆင့် အသုံးပြုနိုင်စေသော ဝန်ဆောင်မှု။</li> <li><strong>Mask Token</strong>: <code>fill-mask</code> လုပ်ငန်းတာဝန်များတွင် စာသားထဲက ကွက်လပ်တစ်ခုကို ကိုယ်စားပြုသော အထူး token။</li> <li><strong>Named Entity Recognition (NER)</strong>: စာသားတစ်ခုထဲက လူအမည်၊ နေရာအမည်၊ အဖွဲ့အစည်းအမည် စတဲ့ သီးခြားအမည်တွေကို ရှာဖွေဖော်ထုတ်ခြင်း။</li> <li><strong>Entities</strong>: အချက်အလက်များ သို့မဟုတ် အရာဝတ္ထုများ (ဥပမာ- လူ၊ နေရာ၊ အဖွဲ့အစည်း)။</li> <li><strong><code>grouped_entities</code></strong>: NER pipeline တွင် အတူတူရှိသော entity အပိုင်းအစများကို တစ်ခုတည်းအဖြစ် စုစည်းရန် အသုံးပြုသော option။</li> <li><strong>Part-of-speech Tagging (POS)</strong>: စာကြောင်းတစ်ခုရှိ စကားလုံးတစ်လုံးစီ၏ သဒ္ဒါဆိုင်ရာ အစိတ်အပိုင်း (ဥပမာ- နာမ်၊ ကြိယာ၊ နာမဝိသေသန) ကို ခွဲခြားသတ်မှတ်ခြင်း။</li> <li><strong>Question Answering</strong>: မေးခွန်းတစ်ခုနဲ့ ပေးထားတဲ့ အကြောင်းအရာတစ်ခုကနေ အချက်အလက်တွေကို ထုတ်ယူပြီး အဖြေရှာတဲ့ လုပ်ငန်းတာဝန်။</li> <li><strong><code>min_length</code></strong>: text generation သို့မဟုတ် summarization pipeline တွင် ထွက်ပေါ်လာမည့် output text ၏ အတိုဆုံး ဖြစ်နိုင်သော အရှည်ကို သတ်မှတ်ရန် အသုံးပြုသော argument။</li> <li><strong>Multilingual Models</strong>: ဘာသာစကားများစွာကို နားလည်ပြီး လုပ်ဆောင်နိုင်သော မော်ဒယ်များ။</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/chapter1/3.mdx" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_dep9rk = { | |
| assets: "/docs/course/pr_1107/my", | |
| base: "/docs/course/pr_1107/my", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/course/pr_1107/my/_app/immutable/entry/start.5c6233a8.js"), | |
| import("/docs/course/pr_1107/my/_app/immutable/entry/app.55586789.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 7], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 131 kB
- Xet hash:
- 5e6c05b66eedc9c16263ea68628dd175b7d7a0626834011adbb78fdfceb582a6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.