Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"๐ค Transformers๋ก ํ ์ ์๋ ๊ฒ","local":"what__transformers_can_do","sections":[{"title":"์ค๋์ค","local":"audio","sections":[{"title":"์ค๋์ค ๋ถ๋ฅ","local":"audio_classification","sections":[],"depth":3},{"title":"์๋ ์์ฑ ์ธ์","local":"automatic_speech_recognition","sections":[],"depth":3}],"depth":2},{"title":"์ปดํจํฐ ๋น์ ","local":"computer_vision","sections":[{"title":"์ด๋ฏธ์ง ๋ถ๋ฅ","local":"image_classification","sections":[],"depth":3},{"title":"๊ฐ์ฒด ํ์ง","local":"object_detection","sections":[],"depth":3},{"title":"์ด๋ฏธ์ง ๋ถํ ","local":"image_segmentation","sections":[],"depth":3},{"title":"๊น์ด ์ถ์ ","local":"depth_estimation","sections":[],"depth":3}],"depth":2},{"title":"์์ฐ์ด์ฒ๋ฆฌ","local":"natural_language_processing","sections":[{"title":"ํ ์คํธ ๋ถ๋ฅ","local":"text_classification","sections":[],"depth":3},{"title":"ํ ํฐ ๋ถ๋ฅ","local":"token_classification","sections":[],"depth":3},{"title":"์ง์์๋ต","local":"question_answering","sections":[],"depth":3},{"title":"์์ฝ","local":"summarization","sections":[],"depth":3},{"title":"๋ฒ์ญ","local":"translation","sections":[],"depth":3},{"title":"์ธ์ด ๋ชจ๋ธ๋ง","local":"language_modeling","sections":[],"depth":3}],"depth":2}],"depth":1}"> | |
| <link href="/docs/transformers/main/ko/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/entry/start.9aa88961.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/chunks/scheduler.9bc65507.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/chunks/singletons.9eec45c3.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/chunks/index.3b203c72.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/chunks/paths.566078f7.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/entry/app.84fb67c3.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/chunks/index.707bf1b6.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/nodes/0.1c99376b.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/nodes/60.d464a935.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/chunks/CodeBlock.54a9f38d.js"> | |
| <link rel="modulepreload" href="/docs/transformers/main/ko/_app/immutable/chunks/EditOnGithub.922df6ba.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"๐ค Transformers๋ก ํ ์ ์๋ ๊ฒ","local":"what__transformers_can_do","sections":[{"title":"์ค๋์ค","local":"audio","sections":[{"title":"์ค๋์ค ๋ถ๋ฅ","local":"audio_classification","sections":[],"depth":3},{"title":"์๋ ์์ฑ ์ธ์","local":"automatic_speech_recognition","sections":[],"depth":3}],"depth":2},{"title":"์ปดํจํฐ ๋น์ ","local":"computer_vision","sections":[{"title":"์ด๋ฏธ์ง ๋ถ๋ฅ","local":"image_classification","sections":[],"depth":3},{"title":"๊ฐ์ฒด ํ์ง","local":"object_detection","sections":[],"depth":3},{"title":"์ด๋ฏธ์ง ๋ถํ ","local":"image_segmentation","sections":[],"depth":3},{"title":"๊น์ด ์ถ์ ","local":"depth_estimation","sections":[],"depth":3}],"depth":2},{"title":"์์ฐ์ด์ฒ๋ฆฌ","local":"natural_language_processing","sections":[{"title":"ํ ์คํธ ๋ถ๋ฅ","local":"text_classification","sections":[],"depth":3},{"title":"ํ ํฐ ๋ถ๋ฅ","local":"token_classification","sections":[],"depth":3},{"title":"์ง์์๋ต","local":"question_answering","sections":[],"depth":3},{"title":"์์ฝ","local":"summarization","sections":[],"depth":3},{"title":"๋ฒ์ญ","local":"translation","sections":[],"depth":3},{"title":"์ธ์ด ๋ชจ๋ธ๋ง","local":"language_modeling","sections":[],"depth":3}],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="what__transformers_can_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="#what__transformers_can_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> <p data-svelte-h="svelte-10idx7x">๐ค Transformers๋ ์์ฐ์ด์ฒ๋ฆฌ(NLP), ์ปดํจํฐ ๋น์ , ์ค๋์ค ๋ฐ ์์ฑ ์ฒ๋ฆฌ ์์ ์ ๋ํ ์ฌ์ ํ๋ จ๋ ์ต์ฒจ๋จ ๋ชจ๋ธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค. | |
| ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ํธ๋์คํฌ๋จธ ๋ชจ๋ธ๋ฟ๋ง ์๋๋ผ ์ปดํจํฐ ๋น์ ์์ ์ ์ํ ํ๋์ ์ธ ํฉ์ฑ๊ณฑ ์ ๊ฒฝ๋ง๊ณผ ๊ฐ์ ํธ๋์คํฌ๋จธ๊ฐ ์๋ ๋ชจ๋ธ๋ ํฌํจํ๊ณ ์์ต๋๋ค.</p> <p data-svelte-h="svelte-rz0m0r">์ค๋งํธํฐ, ์ฑ, ํ ๋ ๋น์ ๊ณผ ๊ฐ์ ์ค๋๋ ๊ฐ์ฅ ์ธ๊ธฐ ์๋ ์๋น์ ์ ํ์ ์ดํด๋ณด๋ฉด, ๋ฅ๋ฌ๋ ๊ธฐ์ ์ด ๊ทธ ๋ค์ ์ฌ์ฉ๋๊ณ ์์ ํ๋ฅ ์ด ๋์ต๋๋ค. | |
| ์ค๋งํธํฐ์ผ๋ก ์ดฌ์ํ ์ฌ์ง์์ ๋ฐฐ๊ฒฝ ๊ฐ์ฒด๋ฅผ ์ ๊ฑฐํ๊ณ ์ถ๋ค๋ฉด ์ด๋ป๊ฒ ํ ๊น์? ์ด๋ ํ๋ํฑ ์ธ๊ทธ๋ฉํ ์ด์ ์์ ์ ์์ ๋๋ค(์์ง ์ด๊ฒ ๋ฌด์์ธ์ง ๋ชจ๋ฅธ๋ค๋ฉด, ๋ค์ ์น์ ์์ ์ค๋ช ํ๊ฒ ์ต๋๋ค!).</p> <p data-svelte-h="svelte-d62f10">์ด ํ์ด์ง๋ ๋ค์ํ ์์ฑ ๋ฐ ์ค๋์ค, ์ปดํจํฐ ๋น์ , NLP ์์ ์ ๐ค Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ์ฉํ์ฌ ๋ค๋ฃจ๋ ๊ฐ๋จํ ์์ ๋ฅผ 3์ค์ ์ฝ๋๋ก ์ ๊ณตํฉ๋๋ค.</p> <h2 class="relative group"><a id="audio" 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="#audio"><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-13r673m">์์ฑ ๋ฐ ์ค๋์ค ์ฒ๋ฆฌ ์์ ์ ๋ค๋ฅธ ๋ชจ๋ฌ๋ฆฌํฐ์ ์ฝ๊ฐ ๋ค๋ฆ ๋๋ค. ์ด๋ ์ฃผ๋ก ์ค๋์ค๊ฐ ์ฐ์์ ์ธ ์ ํธ๋ก ์ ๋ ฅ๋๊ธฐ ๋๋ฌธ์ ๋๋ค. | |
| ํ ์คํธ์ ๋ฌ๋ฆฌ ์๋ณธ ์ค๋์ค ํํ(waveform)์ ๋ฌธ์ฅ์ด ๋จ์ด๋ก ๋๋ ์ง๋ ๊ฒ์ฒ๋ผ ๊น๋ํ๊ฒ ์ด์ฐ์ ์ธ ๋ฌถ์์ผ๋ก ๋๋ ์ ์์ต๋๋ค. | |
| ์ด๋ฅผ ๊ทน๋ณตํ๊ธฐ ์ํด ์๋ณธ ์ค๋์ค ์ ํธ๋ ์ผ์ ํ ๊ฐ๊ฒฉ์ผ๋ก ์ํ๋ง๋ฉ๋๋ค. ํด๋น ๊ฐ๊ฒฉ ๋ด์์ ๋ ๋ง์ ์ํ์ ์ทจํ ๊ฒฝ์ฐ ์ํ๋ง๋ฅ ์ด ๋์์ง๋ฉฐ, ์ค๋์ค๋ ์๋ณธ ์ค๋์ค ์์ค์ ๋ ๊ฐ๊น์์ง๋๋ค.</p> <p data-svelte-h="svelte-qps12j">๊ณผ๊ฑฐ์ ์ ๊ทผ ๋ฐฉ์์ ์ค๋์ค์์ ์ ์ฉํ ํน์ง์ ์ถ์ถํ๊ธฐ ์ํด ์ค๋์ค๋ฅผ ์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด์์ต๋๋ค. | |
| ํ์ง๋ง ํ์ฌ๋ ์๋ณธ ์ค๋์ค ํํ์ ํน์ฑ ์ธ์ฝ๋์ ์ง์ ๋ฃ์ด์ ์ค๋์ค ํํ(representation)์ ์ถ์ถํ๋ ๊ฒ์ด ๋ ์ผ๋ฐ์ ์ ๋๋ค. | |
| ์ด๋ ๊ฒ ํ๋ฉด ์ ์ฒ๋ฆฌ ๋จ๊ณ๊ฐ ๋จ์ํด์ง๊ณ ๋ชจ๋ธ์ด ๊ฐ์ฅ ์ค์ํ ํน์ง์ ํ์ตํ ์ ์์ต๋๋ค.</p> <h3 class="relative group"><a id="audio_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="#audio_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>์ค๋์ค ๋ถ๋ฅ</span></h3> <p data-svelte-h="svelte-18pih3a">์ค๋์ค ๋ถ๋ฅ๋ ์ค๋์ค ๋ฐ์ดํฐ์ ๋ฏธ๋ฆฌ ์ ์๋ ํด๋์ค ์งํฉ์ ๋ ์ด๋ธ์ ์ง์ ํ๋ ์์ ์ ๋๋ค. ์ด๋ ๋ง์ ๊ตฌ์ฒด์ ์ธ ์์ฉ ํ๋ก๊ทธ๋จ์ ํฌํจํ ๋์ ๋ฒ์ฃผ์ ๋๋ค.</p> <p data-svelte-h="svelte-9ctq6o">์ผ๋ถ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:</p> <ul data-svelte-h="svelte-5dixf0"><li>์ํฅ ์ฅ๋ฉด ๋ถ๋ฅ: ์ค๋์ค์ ์ฅ๋ฉด ๋ ์ด๋ธ(โ์ฌ๋ฌด์คโ, โํด๋ณโ, โ๊ฒฝ๊ธฐ์ฅโ)์ ์ง์ ํฉ๋๋ค.</li> <li>์ํฅ ์ด๋ฒคํธ ๊ฐ์ง: ์ค๋์ค์ ์๋ฆฌ ์ด๋ฒคํธ ๋ ์ด๋ธ(โ์ฐจ ๊ฒฝ์ โ, โ๊ณ ๋ ์ธ์์๋ฆฌโ, โ์ ๋ฆฌ ํ์โ)์ ์ง์ ํฉ๋๋ค.</li> <li>ํ๊น : ์ฌ๋ฌ ๊ฐ์ง ์๋ฆฌ(์ ์ง์ ๊ท, ํ์์์์ ํ์ ์๋ณ)๊ฐ ํฌํจ๋ ์ค๋์ค์ ๋ ์ด๋ธ์ ์ง์ ํฉ๋๋ค.</li> <li>์์ ๋ถ๋ฅ: ์์ ์ ์ฅ๋ฅด ๋ ์ด๋ธ(โ๋ฉํโ, โํํฉโ, โ์ปจํธ๋ฆฌโ)์ ์ง์ ํฉ๋๋ค.</li></ul> <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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>classifier = pipeline(task=<span class="hljs-string">"audio-classification"</span>, model=<span class="hljs-string">"superb/hubert-base-superb-er"</span>) | |
| <span class="hljs-meta">>>> </span>preds = classifier(<span class="hljs-string">"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac"</span>) | |
| <span class="hljs-meta">>>> </span>preds = [{<span class="hljs-string">"score"</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">"score"</span>], <span class="hljs-number">4</span>), <span class="hljs-string">"label"</span>: pred[<span class="hljs-string">"label"</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds] | |
| <span class="hljs-meta">>>> </span>preds | |
| [{<span class="hljs-string">'score'</span>: <span class="hljs-number">0.4532</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'hap'</span>}, | |
| {<span class="hljs-string">'score'</span>: <span class="hljs-number">0.3622</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'sad'</span>}, | |
| {<span class="hljs-string">'score'</span>: <span class="hljs-number">0.0943</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'neu'</span>}, | |
| {<span class="hljs-string">'score'</span>: <span class="hljs-number">0.0903</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'ang'</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>์๋ ์์ฑ ์ธ์</span></h3> <p data-svelte-h="svelte-cdyfh4">์๋ ์์ฑ ์ธ์(ASR)์ ์์ฑ์ ํ ์คํธ๋ก ๋ณํํ๋ ์์ ์ ๋๋ค. | |
| ์์ฑ์ ์ธ๊ฐ์ ์์ฐ์ค๋ฌ์ด ์์ฌ์ํต ํํ์ด๊ธฐ ๋๋ฌธ์ ASR์ ๊ฐ์ฅ ์ผ๋ฐ์ ์ธ ์ค๋์ค ์์ ์ค ํ๋์ ๋๋ค. | |
| ์ค๋๋ ASR ์์คํ ์ ์คํผ์ปค, ์ ํ ๋ฐ ์๋์ฐจ์ ๊ฐ์ โ์ค๋งํธโ ๊ธฐ์ ์ ํ์ ๋ด์ฅ๋์ด ์์ต๋๋ค. | |
| ์ฐ๋ฆฌ๋ ๊ฐ์ ๋น์์๊ฒ ์์ ์ฌ์, ์๋ฆผ ์ค์ ๋ฐ ๋ ์จ ์ ๋ณด๋ฅผ ์์ฒญํ ์ ์์ต๋๋ค.</p> <p data-svelte-h="svelte-190cybw">ํ์ง๋ง ํธ๋์คํฌ๋จธ ์ํคํ ์ฒ๊ฐ ํด๊ฒฐํ๋ ๋ฐ ๋์์ ์ค ํต์ฌ ๋์ ๊ณผ์ ์ค ํ๋๋ ์์ด ๋ฐ์ดํฐ ์์ด ์ ์ ์ธ์ด(low-resource language)์ ๋ํ ๊ฒ์ ๋๋ค. ๋๋์ ์์ฑ ๋ฐ์ดํฐ๋ก ์ฌ์ ํ๋ จํ ํ ๋ฐ์ดํฐ ์์ด ์ ์ ์ธ์ด์์ ๋ ์ด๋ธ์ด ์ง์ ๋ ์์ฑ ๋ฐ์ดํฐ 1์๊ฐ๋ง์ผ๋ก ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ฉด ์ด์ ์ 100๋ฐฐ ๋ง์ ๋ ์ด๋ธ์ด ์ง์ ๋ ๋ฐ์ดํฐ๋ก ํ๋ จ๋ ASR ์์คํ ๋ณด๋ค ํจ์ฌ ๋ ๋์ ํ์ง์ ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์์ต๋๋ค.</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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>transcriber = pipeline(task=<span class="hljs-string">"automatic-speech-recognition"</span>, model=<span class="hljs-string">"openai/whisper-small"</span>) | |
| <span class="hljs-meta">>>> </span>transcriber(<span class="hljs-string">"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac"</span>) | |
| {<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="computer_vision" 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="#computer_vision"><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-lp1ekz">์ปดํจํฐ ๋น์ ์์ ์ค ๊ฐ์ฅ ์ด๊ธฐ์ ์ฑ๊ณต์ ์ธ ์์ ์ค ํ๋๋ <a href="glossary#convolution">ํฉ์ฑ๊ณฑ ์ ๊ฒฝ๋ง(CNN)</a>์ ์ฌ์ฉํ์ฌ ์ฐํธ๋ฒํธ ์ซ์ ์ด๋ฏธ์ง๋ฅผ ์ธ์ํ๋ ๊ฒ์ด์์ต๋๋ค. ์ด๋ฏธ์ง๋ ํฝ์ ๋ก ๊ตฌ์ฑ๋์ด ์์ผ๋ฉฐ ๊ฐ ํฝ์ ์ ์ซ์ ๊ฐ์ผ๋ก ํํ๋ฉ๋๋ค. ์ด๋ก์จ ์ด๋ฏธ์ง๋ฅผ ํฝ์ ๊ฐ์ ํ๋ ฌ๋ก ๋ํ๋ด๋ ๊ฒ์ด ์ฌ์์ง๋๋ค. ํน์ ํ ํฝ์ ๊ฐ์ ์กฐํฉ์ ์ด๋ฏธ์ง์ ์์์ ์๋ฏธํฉ๋๋ค.</p> <p data-svelte-h="svelte-uo6axu">์ปดํจํฐ ๋น์ ์์ ์ ์ผ๋ฐ์ ์ผ๋ก ๋ค์ ๋ ๊ฐ์ง ๋ฐฉ๋ฒ์ผ๋ก ์ ๊ทผ ๊ฐ๋ฅํฉ๋๋ค:</p> <ol data-svelte-h="svelte-imx589"><li><p>ํฉ์ฑ๊ณฑ์ ์ฌ์ฉํ์ฌ ์ด๋ฏธ์ง์ ๋ฎ์ ์์ค ํน์ง์์ ๋์ ์์ค์ ์ถ์์ ์ธ ์์๊น์ง ๊ณ์ธต์ ์ผ๋ก ํ์ตํฉ๋๋ค.</p></li> <li><p>์ด๋ฏธ์ง๋ฅผ ํจ์น๋ก ๋๋๊ณ ํธ๋์คํฌ๋จธ๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ง์ ์ผ๋ก ๊ฐ ์ด๋ฏธ์ง ํจ์น๊ฐ ์๋ก ์ด๋ ํ ๋ฐฉ์์ผ๋ก ์ฐ๊ด๋์ด ์ด๋ฏธ์ง๋ฅผ ํ์ฑํ๋์ง ํ์ตํฉ๋๋ค. <code>CNN</code>์์ ์ ํธํ๋ ์ํฅ์ ์ ๊ทผ๋ฒ๊ณผ๋ ๋ฌ๋ฆฌ, ์ด ๋ฐฉ์์ ํ๋ฆฟํ ์ด๋ฏธ์ง๋ก ์ด์์ ๊ทธ๋ฆฌ๊ณ ์ ์ง์ ์ผ๋ก ์ ๋ช ํ ์ด๋ฏธ์ง๋ก ๋ง๋ค์ด๊ฐ๋ ๊ฒ๊ณผ ์ ์ฌํฉ๋๋ค.</p></li></ol> <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>์ด๋ฏธ์ง ๋ถ๋ฅ</span></h3> <p data-svelte-h="svelte-1o1g4f9">์ด๋ฏธ์ง ๋ถ๋ฅ๋ ํ ๊ฐ์ ์ ์ฒด ์ด๋ฏธ์ง์ ๋ฏธ๋ฆฌ ์ ์๋ ํด๋์ค ์งํฉ์ ๋ ์ด๋ธ์ ์ง์ ํ๋ ์์ ์ ๋๋ค.</p> <p data-svelte-h="svelte-14qqsoc">๋๋ถ๋ถ์ ๋ถ๋ฅ ์์ ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก, ์ด๋ฏธ์ง ๋ถ๋ฅ์๋ ๋ค์ํ ์ค์ฉ์ ์ธ ์ฉ๋๊ฐ ์์ผ๋ฉฐ, ์ผ๋ถ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:</p> <ul data-svelte-h="svelte-1ong27"><li>์๋ฃ: ์ง๋ณ์ ๊ฐ์งํ๊ฑฐ๋ ํ์ ๊ฑด๊ฐ์ ๋ชจ๋ํฐ๋งํ๊ธฐ ์ํด ์๋ฃ ์ด๋ฏธ์ง์ ๋ ์ด๋ธ์ ์ง์ ํฉ๋๋ค.</li> <li>ํ๊ฒฝ: ์์ฑ ์ด๋ฏธ์ง๋ฅผ ๋ถ๋ฅํ์ฌ ์ฐ๋ฆผ ๋ฒ์ฑ๋ฅผ ๊ฐ์ํ๊ณ ์ผ์ ์ง์ญ ๊ด๋ฆฌ๋ฅผ ์ํ ์ ๋ณด๋ฅผ ์ ๊ณตํ๊ฑฐ๋ ์ฐ๋ถ์ ๊ฐ์งํฉ๋๋ค.</li> <li>๋์ : ์๋ฌผ ์ด๋ฏธ์ง๋ฅผ ๋ถ๋ฅํ์ฌ ์๋ฌผ ๊ฑด๊ฐ์ ํ์ธํ๊ฑฐ๋ ์์ฑ ์ด๋ฏธ์ง๋ฅผ ๋ถ๋ฅํ์ฌ ํ ์ง ์ด์ฉ ๊ด์ฐฐ์ ์ฌ์ฉํฉ๋๋ค.</li> <li>์ํํ: ๋๋ฌผ์ด๋ ์๋ฌผ ์ข ์ด๋ฏธ์ง๋ฅผ ๋ถ๋ฅํ์ฌ ์ผ์ ๋๋ฌผ ๊ฐ์ฒด๊ตฐ์ ์กฐ์ฌํ๊ฑฐ๋ ๋ฉธ์ข ์๊ธฐ์ ์ฒํ ์ข ์ ์ถ์ ํฉ๋๋ค.</li></ul> <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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>classifier = pipeline(task=<span class="hljs-string">"image-classification"</span>) | |
| <span class="hljs-meta">>>> </span>preds = classifier( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>preds = [{<span class="hljs-string">"score"</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">"score"</span>], <span class="hljs-number">4</span>), <span class="hljs-string">"label"</span>: pred[<span class="hljs-string">"label"</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds] | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(*preds, sep=<span class="hljs-string">"\n"</span>) | |
| {<span class="hljs-string">'score'</span>: <span class="hljs-number">0.4335</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'lynx, catamount'</span>} | |
| {<span class="hljs-string">'score'</span>: <span class="hljs-number">0.0348</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.0324</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.0239</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.0229</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'tiger cat'</span>}<!-- HTML_TAG_END --></pre></div> <h3 class="relative group"><a id="object_detection" 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="#object_detection"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>๊ฐ์ฒด ํ์ง</span></h3> <p data-svelte-h="svelte-10dx22t">์ด๋ฏธ์ง ๋ถ๋ฅ์ ๋ฌ๋ฆฌ ๊ฐ์ฒด ํ์ง๋ ์ด๋ฏธ์ง ๋ด์์ ์ฌ๋ฌ ๊ฐ์ฒด๋ฅผ ์๋ณํ๊ณ ๋ฐ์ด๋ฉ ๋ฐ์ค๋ก ์ ์๋ ๊ฐ์ฒด์ ์์น๋ฅผ ํ์ ํฉ๋๋ค.</p> <p data-svelte-h="svelte-1bbfjj6">๊ฐ์ฒด ํ์ง์ ๋ช ๊ฐ์ง ์์ฉ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:</p> <ul data-svelte-h="svelte-doxpjs"><li>์์จ ์ฃผํ ์ฐจ๋: ๋ค๋ฅธ ์ฐจ๋, ๋ณดํ์ ๋ฐ ์ ํธ๋ฑ๊ณผ ๊ฐ์ ์ผ์์ ์ธ ๊ตํต ๊ฐ์ฒด๋ฅผ ๊ฐ์งํฉ๋๋ค.</li> <li>์๊ฒฉ ๊ฐ์ง: ์ฌ๋ ๋ชจ๋ํฐ๋ง, ๋์ ๊ณํ ๋ฐ ๊ธฐ์ ์์ธก ๋ฑ์ ์ํํฉ๋๋ค.</li> <li>๊ฒฐํจ ํ์ง: ๊ฑด๋ฌผ์ ๊ท ์ด์ด๋ ๊ตฌ์กฐ์ ์์, ์ ์กฐ ๊ฒฐํจ ๋ฑ์ ํ์งํฉ๋๋ค.</li></ul> <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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>detector = pipeline(task=<span class="hljs-string">"object-detection"</span>) | |
| <span class="hljs-meta">>>> </span>preds = detector( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>preds = [{<span class="hljs-string">"score"</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">"score"</span>], <span class="hljs-number">4</span>), <span class="hljs-string">"label"</span>: pred[<span class="hljs-string">"label"</span>], <span class="hljs-string">"box"</span>: pred[<span class="hljs-string">"box"</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds] | |
| <span class="hljs-meta">>>> </span>preds | |
| [{<span class="hljs-string">'score'</span>: <span class="hljs-number">0.9865</span>, | |
| <span class="hljs-string">'label'</span>: <span class="hljs-string">'cat'</span>, | |
| <span class="hljs-string">'box'</span>: {<span class="hljs-string">'xmin'</span>: <span class="hljs-number">178</span>, <span class="hljs-string">'ymin'</span>: <span class="hljs-number">154</span>, <span class="hljs-string">'xmax'</span>: <span class="hljs-number">882</span>, <span class="hljs-string">'ymax'</span>: <span class="hljs-number">598</span>}}]<!-- HTML_TAG_END --></pre></div> <h3 class="relative group"><a id="image_segmentation" 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_segmentation"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>์ด๋ฏธ์ง ๋ถํ </span></h3> <p data-svelte-h="svelte-uvfxg5">์ด๋ฏธ์ง ๋ถํ ์ ํฝ์ ์ฐจ์์ ์์ ์ผ๋ก, ์ด๋ฏธ์ง ๋ด์ ๋ชจ๋ ํฝ์ ์ ํด๋์ค์ ํ ๋นํฉ๋๋ค. ์ด๋ ๊ฐ์ฒด ํ์ง์ ๋ค๋ฆ ๋๋ค. ๊ฐ์ฒด ํ์ง๋ ๋ฐ์ด๋ฉ ๋ฐ์ค๋ฅผ ์ฌ์ฉํ์ฌ ์ด๋ฏธ์ง ๋ด์ ๊ฐ์ฒด๋ฅผ ๋ ์ด๋ธ๋งํ๊ณ ์์ธกํ๋ ๋ฐ๋ฉด, ๋ถํ ์ ๋ ์ธ๋ถํ๋ ์์ ์ ๋๋ค. ๋ถํ ์ ํฝ์ ์์ค์์ ๊ฐ์ฒด๋ฅผ ๊ฐ์งํ ์ ์์ต๋๋ค.</p> <p data-svelte-h="svelte-1hwst5e">์ด๋ฏธ์ง ๋ถํ ์๋ ์ฌ๋ฌ ์ ํ์ด ์์ต๋๋ค:</p> <ul data-svelte-h="svelte-bh6x2l"><li>์ธ์คํด์ค ๋ถํ : ๊ฐ์ฒด์ ํด๋์ค๋ฅผ ๋ ์ด๋ธ๋งํ๋ ๊ฒ ์ธ์๋, ๊ฐ์ฒด์ ๊ฐ ๊ตฌ๋ถ๋ ์ธ์คํด์ค์๋ ๋ ์ด๋ธ์ ์ง์ ํฉ๋๋ค (โ๊ฐ-1โ, โ๊ฐ-2โ ๋ฑ).</li> <li>ํ๋ํฑ ๋ถํ : ์๋ฏธ์ ๋ถํ ๊ณผ ์ธ์คํด์ค ๋ถํ ์ ์กฐํฉ์ ๋๋ค. ๊ฐ ํฝ์ ์ ์๋ฏธ์ ํด๋์ค๋ก ๋ ์ด๋ธ๋งํ๋ <strong>๋์์</strong> ๊ฐ์ฒด์ ๊ฐ๊ฐ ๊ตฌ๋ถ๋ ์ธ์คํด์ค๋ก๋ ๋ ์ด๋ธ์ ์ง์ ํฉ๋๋ค.</li></ul> <p data-svelte-h="svelte-1spkl8f">๋ถํ ์์ ์ ์์จ ์ฃผํ ์ฐจ๋์์ ์ ์ฉํ๋ฉฐ, ์ฃผ๋ณ ํ๊ฒฝ์ ํฝ์ ์์ค ์ง๋๋ฅผ ์์ฑํ์ฌ ๋ณดํ์์ ๋ค๋ฅธ ์ฐจ๋ ์ฃผ๋ณ์์ ์์ ํ๊ฒ ํ์ํ ์ ์์ต๋๋ค. ๋ํ ์๋ฃ ์์์์๋ ์ ์ฉํฉ๋๋ค. ๋ถํ ์์ ์ด ํฝ์ ์์ค์์ ๊ฐ์ฒด๋ฅผ ๊ฐ์งํ ์ ์๊ธฐ ๋๋ฌธ์ ๋น์ ์์ ์ธ ์ธํฌ๋ ์ฅ๊ธฐ์ ํน์ง์ ์๋ณํ๋ ๋ฐ ๋์์ด ๋ ์ ์์ต๋๋ค. ์ด๋ฏธ์ง ๋ถํ ์ ์๋ฅ ๊ฐ์ ์์ฐฉ์ด๋ ์นด๋ฉ๋ผ๋ฅผ ํตํด ์ค์ ์ธ๊ณ์ ๊ฐ์ ๊ฐ์ฒด๋ฅผ ๋ง์์ ์ฆ๊ฐ ํ์ค ๊ฒฝํ์ ๋ง๋๋ ๋ฑ ์ ์ ์๊ฑฐ๋ ๋ถ์ผ์์๋ ์ฌ์ฉ๋ ์ ์์ต๋๋ค.</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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>segmenter = pipeline(task=<span class="hljs-string">"image-segmentation"</span>) | |
| <span class="hljs-meta">>>> </span>preds = segmenter( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>preds = [{<span class="hljs-string">"score"</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">"score"</span>], <span class="hljs-number">4</span>), <span class="hljs-string">"label"</span>: pred[<span class="hljs-string">"label"</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds] | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(*preds, sep=<span class="hljs-string">"\n"</span>) | |
| {<span class="hljs-string">'score'</span>: <span class="hljs-number">0.9879</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'LABEL_184'</span>} | |
| {<span class="hljs-string">'score'</span>: <span class="hljs-number">0.9973</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'snow'</span>} | |
| {<span class="hljs-string">'score'</span>: <span class="hljs-number">0.9972</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'cat'</span>}<!-- HTML_TAG_END --></pre></div> <h3 class="relative group"><a id="depth_estimation" 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="#depth_estimation"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>๊น์ด ์ถ์ </span></h3> <p data-svelte-h="svelte-1exjil8">๊น์ด ์ถ์ ์ ์นด๋ฉ๋ผ๋ก๋ถํฐ ์ด๋ฏธ์ง ๋ด๋ถ์ ๊ฐ ํฝ์ ์ ๊ฑฐ๋ฆฌ๋ฅผ ์์ธกํฉ๋๋ค. ์ด ์ปดํจํฐ ๋น์ ์์ ์ ํนํ ์ฅ๋ฉด ์ดํด์ ์ฌ๊ตฌ์ฑ์ ์ค์ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์์จ ์ฃผํ ์ฐจ๋์ ๋ณดํ์, ๊ตํต ํ์งํ ๋ฐ ๋ค๋ฅธ ์ฐจ๋๊ณผ ๊ฐ์ ๊ฐ์ฒด์์ ๊ฑฐ๋ฆฌ๋ฅผ ์ดํดํ์ฌ ์ฅ์ ๋ฌผ๊ณผ ์ถฉ๋์ ํผํด์ผ ํฉ๋๋ค. ๊น์ด ์ ๋ณด๋ ๋ํ 2D ์ด๋ฏธ์ง์์ 3D ํํ์ ๊ตฌ์ฑํ๋ ๋ฐ ๋์์ด ๋๋ฉฐ ์๋ฌผํ์ ๊ตฌ์กฐ๋ ๊ฑด๋ฌผ์ ๊ณ ํ์ง 3D ํํ์ ์์ฑํ๋ ๋ฐ ์ฌ์ฉ๋ ์ ์์ต๋๋ค.</p> <p data-svelte-h="svelte-skr9n9">๊น์ด ์ถ์ ์๋ ๋ ๊ฐ์ง ์ ๊ทผ ๋ฐฉ์์ด ์์ต๋๋ค:</p> <ul data-svelte-h="svelte-urw9j1"><li>์คํ ๋ ์ค: ์ฝ๊ฐ ๋ค๋ฅธ ๊ฐ๋์์ ์ดฌ์๋ ๋์ผํ ์ด๋ฏธ์ง ๋ ์ฅ์ ๋น๊ตํ์ฌ ๊น์ด๋ฅผ ์ถ์ ํฉ๋๋ค.</li> <li>๋จ์: ๋จ์ผ ์ด๋ฏธ์ง์์ ๊น์ด๋ฅผ ์ถ์ ํฉ๋๋ค.</li></ul> <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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>depth_estimator = pipeline(task=<span class="hljs-string">"depth-estimation"</span>) | |
| <span class="hljs-meta">>>> </span>preds = depth_estimator( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"</span> | |
| <span class="hljs-meta">... </span>)<!-- HTML_TAG_END --></pre></div> <h2 class="relative group"><a id="natural_language_processing" 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="#natural_language_processing"><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-juznik">ํ ์คํธ๋ ์ธ๊ฐ์ด ์์ฌ ์ํตํ๋ ์์ฐ์ค๋ฌ์ด ๋ฐฉ์ ์ค ํ๋์ด๊ธฐ ๋๋ฌธ์ ์์ฐ์ด์ฒ๋ฆฌ ์ญ์ ๊ฐ์ฅ ์ผ๋ฐ์ ์ธ ์์ ์ ํ ์ค ํ๋์ ๋๋ค. ๋ชจ๋ธ์ด ์ธ์ํ๋ ํ์์ผ๋ก ํ ์คํธ๋ฅผ ๋ณํํ๋ ค๋ฉด ํ ํฐํํด์ผ ํฉ๋๋ค. ์ด๋ ํ ์คํธ ์ํ์ค๋ฅผ ๊ฐ๋ณ ๋จ์ด ๋๋ ํ์ ๋จ์ด(ํ ํฐ)๋ก ๋ถํ ํ ๋ค์ ์ด๋ฌํ ํ ํฐ์ ์ซ์๋ก ๋ณํํ๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค. ๊ฒฐ๊ณผ์ ์ผ๋ก ํ ์คํธ ์ํ์ค๋ฅผ ์ซ์ ์ํ์ค๋ก ํํํ ์ ์์ผ๋ฉฐ, ์ซ์ ์ํ์ค๋ฅผ ๋ค์ํ ์์ฐ์ด์ฒ๋ฆฌ ์์ ์ ํด๊ฒฐํ๊ธฐ ์ํ ๋ชจ๋ธ์ ์ ๋ ฅํ ์ ์์ต๋๋ค!</p> <h3 class="relative group"><a id="text_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="#text_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>ํ ์คํธ ๋ถ๋ฅ</span></h3> <p data-svelte-h="svelte-1i4o3md">๋ค๋ฅธ ๋ชจ๋ฌ๋ฆฌํฐ์์์ ๋ถ๋ฅ ์์ ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ํ ์คํธ ๋ถ๋ฅ๋ ๋ฏธ๋ฆฌ ์ ์๋ ํด๋์ค ์งํฉ์์ ํ ์คํธ ์ํ์ค(๋ฌธ์ฅ ์์ค, ๋จ๋ฝ ๋๋ ๋ฌธ์ ๋ฑ)์ ๋ ์ด๋ธ์ ์ง์ ํฉ๋๋ค. ํ ์คํธ ๋ถ๋ฅ์๋ ๋ค์ํ ์ค์ฉ์ ์ธ ์์ฉ ์ฌ๋ก๊ฐ ์์ผ๋ฉฐ, ์ผ๋ถ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:</p> <ul data-svelte-h="svelte-5w2u0i"><li>๊ฐ์ฑ ๋ถ์: ํ ์คํธ๋ฅผ <code>๊ธ์ </code> ๋๋ <code>๋ถ์ </code>๊ณผ ๊ฐ์ ์ด๋ค ๊ทน์ฑ์ ๋ฐ๋ผ ๋ ์ด๋ธ๋งํ์ฌ ์ ์น, ๊ธ์ต, ๋ง์ผํ ๊ณผ ๊ฐ์ ๋ถ์ผ์์ ์์ฌ ๊ฒฐ์ ์ ์ ๋ณด๋ฅผ ์ ๊ณตํ๊ณ ์ง์ํ ์ ์์ต๋๋ค.</li> <li>์ฝํ ์ธ ๋ถ๋ฅ: ํ ์คํธ๋ฅผ ์ฃผ์ ์ ๋ฐ๋ผ ๋ ์ด๋ธ๋ง(๋ ์จ, ์คํฌ์ธ , ๊ธ์ต ๋ฑ)ํ์ฌ ๋ด์ค ๋ฐ ์์ ๋ฏธ๋์ด ํผ๋์์ ์ ๋ณด๋ฅผ ๊ตฌ์ฑํ๊ณ ํํฐ๋งํ๋ ๋ฐ ๋์์ด ๋ ์ ์์ต๋๋ค.</li></ul> <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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>classifier = pipeline(task=<span class="hljs-string">"sentiment-analysis"</span>) | |
| <span class="hljs-meta">>>> </span>preds = classifier(<span class="hljs-string">"Hugging Face is the best thing since sliced bread!"</span>) | |
| <span class="hljs-meta">>>> </span>preds = [{<span class="hljs-string">"score"</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">"score"</span>], <span class="hljs-number">4</span>), <span class="hljs-string">"label"</span>: pred[<span class="hljs-string">"label"</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds] | |
| <span class="hljs-meta">>>> </span>preds | |
| [{<span class="hljs-string">'score'</span>: <span class="hljs-number">0.9991</span>, <span class="hljs-string">'label'</span>: <span class="hljs-string">'POSITIVE'</span>}]<!-- HTML_TAG_END --></pre></div> <h3 class="relative group"><a id="token_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="#token_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>ํ ํฐ ๋ถ๋ฅ</span></h3> <p data-svelte-h="svelte-1hgqh5j">๋ชจ๋ ์์ฐ์ด์ฒ๋ฆฌ ์์ ์์๋ ํ ์คํธ๊ฐ ๊ฐ๋ณ ๋จ์ด๋ ํ์ ๋จ์ด๋ก ๋ถ๋ฆฌ๋์ด ์ ์ฒ๋ฆฌ๋ฉ๋๋ค. ๋ถ๋ฆฌ๋ ๋จ์ด๋ฅผ <a href="/glossary#token">ํ ํฐ</a>์ด๋ผ๊ณ ํฉ๋๋ค. ํ ํฐ ๋ถ๋ฅ๋ ๊ฐ ํ ํฐ์ ๋ฏธ๋ฆฌ ์ ์๋ ํด๋์ค ์งํฉ์ ๋ ์ด๋ธ์ ํ ๋นํฉ๋๋ค.</p> <p data-svelte-h="svelte-16tsf9c">ํ ํฐ ๋ถ๋ฅ์ ๋ ๊ฐ์ง ์ผ๋ฐ์ ์ธ ์ ํ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:</p> <ul data-svelte-h="svelte-1wq0vai"><li>๊ฐ์ฒด๋ช ์ธ์ (NER): ํ ํฐ์ ์กฐ์ง, ์ธ๋ฌผ, ์์น ๋๋ ๋ ์ง์ ๊ฐ์ ๊ฐ์ฒด ๋ฒ์ฃผ์ ๋ฐ๋ผ ๋ ์ด๋ธ๋งํฉ๋๋ค. NER์ ํนํ ์ ์ ์ฒดํ์ ์ธ ํ๊ฒฝ์์ ์ ์ ์, ๋จ๋ฐฑ์ง ๋ฐ ์ฝ๋ฌผ ์ด๋ฆ์ ๋ ์ด๋ธ์ ์ง์ ํ๋ ๋ฐ ๋๋ฆฌ ์ฌ์ฉ๋ฉ๋๋ค.</li> <li>ํ์ฌ ํ๊น (POS): ๋ช ์ฌ, ๋์ฌ, ํ์ฉ์ฌ์ ๊ฐ์ ํ์ฌ์ ๋ฐ๋ผ ํ ํฐ์ ๋ ์ด๋ธ์ ํ ๋นํฉ๋๋ค. POS๋ ๋ฒ์ญ ์์คํ ์ด ๋์ผํ ๋จ์ด๊ฐ ๋ฌธ๋ฒ์ ์ผ๋ก ์ด๋ป๊ฒ ๋ค๋ฅธ์ง ์ดํดํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค (๋ช ์ฌ๋ก ์ฌ์ฉ๋๋ โbank(์ํ)โ๊ณผ ๋์ฌ๋ก ์ฌ์ฉ๋๋ โbank(์๊ธ์ ์์นํ๋ค)โ๊ณผ ๊ฐ์ ๊ฒฝ์ฐ).</li></ul> <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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>classifier = pipeline(task=<span class="hljs-string">"ner"</span>) | |
| <span class="hljs-meta">>>> </span>preds = classifier(<span class="hljs-string">"Hugging Face is a French company based in New York City."</span>) | |
| <span class="hljs-meta">>>> </span>preds = [ | |
| <span class="hljs-meta">... </span> { | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"entity"</span>: pred[<span class="hljs-string">"entity"</span>], | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"score"</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">"score"</span>], <span class="hljs-number">4</span>), | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"index"</span>: pred[<span class="hljs-string">"index"</span>], | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"word"</span>: pred[<span class="hljs-string">"word"</span>], | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"start"</span>: pred[<span class="hljs-string">"start"</span>], | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"end"</span>: pred[<span class="hljs-string">"end"</span>], | |
| <span class="hljs-meta">... </span> } | |
| <span class="hljs-meta">... </span> <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds | |
| <span class="hljs-meta">... </span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(*preds, sep=<span class="hljs-string">"\n"</span>) | |
| {<span class="hljs-string">'entity'</span>: <span class="hljs-string">'I-ORG'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9968</span>, <span class="hljs-string">'index'</span>: <span class="hljs-number">1</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'Hu'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">0</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">2</span>} | |
| {<span class="hljs-string">'entity'</span>: <span class="hljs-string">'I-ORG'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9293</span>, <span class="hljs-string">'index'</span>: <span class="hljs-number">2</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'##gging'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">2</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">7</span>} | |
| {<span class="hljs-string">'entity'</span>: <span class="hljs-string">'I-ORG'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9763</span>, <span class="hljs-string">'index'</span>: <span class="hljs-number">3</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'Face'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">8</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">12</span>} | |
| {<span class="hljs-string">'entity'</span>: <span class="hljs-string">'I-MISC'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9983</span>, <span class="hljs-string">'index'</span>: <span class="hljs-number">6</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'French'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">18</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">24</span>} | |
| {<span class="hljs-string">'entity'</span>: <span class="hljs-string">'I-LOC'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.999</span>, <span class="hljs-string">'index'</span>: <span class="hljs-number">10</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'New'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">42</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">45</span>} | |
| {<span class="hljs-string">'entity'</span>: <span class="hljs-string">'I-LOC'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9987</span>, <span class="hljs-string">'index'</span>: <span class="hljs-number">11</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'York'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">46</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">50</span>} | |
| {<span class="hljs-string">'entity'</span>: <span class="hljs-string">'I-LOC'</span>, <span class="hljs-string">'score'</span>: <span class="hljs-number">0.9992</span>, <span class="hljs-string">'index'</span>: <span class="hljs-number">12</span>, <span class="hljs-string">'word'</span>: <span class="hljs-string">'City'</span>, <span class="hljs-string">'start'</span>: <span class="hljs-number">51</span>, <span class="hljs-string">'end'</span>: <span class="hljs-number">55</span>}<!-- HTML_TAG_END --></pre></div> <h3 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>์ง์์๋ต</span></h3> <p data-svelte-h="svelte-1bb9mft">์ง์์๋ต์ ๋ ํ๋์ ํ ํฐ ์ฐจ์์ ์์ ์ผ๋ก, ๋ฌธ๋งฅ์ด ์์ ๋(๊ฐ๋ฐฉํ ๋๋ฉ์ธ)์ ๋ฌธ๋งฅ์ด ์์ ๋(ํ์ํ ๋๋ฉ์ธ) ์ง๋ฌธ์ ๋ํ ๋ต๋ณ์ ๋ฐํํฉ๋๋ค. ์ด ์์ ์ ๊ฐ์ ๋น์์๊ฒ ์๋น์ด ์์ ์ค์ธ์ง์ ๊ฐ์ ์ง๋ฌธ์ ํ ๋๋ง๋ค ๋ฐ์ํ ์ ์์ต๋๋ค. ๊ณ ๊ฐ ์ง์ ๋๋ ๊ธฐ์ ์ง์์ ์ ๊ณตํ๊ฑฐ๋ ๊ฒ์ ์์ง์ด ์์ฒญํ ์ ๋ณด๋ฅผ ๊ฒ์ํ๋ ๋ฐ ๋์์ ์ค ์ ์์ต๋๋ค.</p> <p data-svelte-h="svelte-17o3plg">์ง๋ฌธ ๋ต๋ณ์๋ ์ผ๋ฐ์ ์ผ๋ก ๋ ๊ฐ์ง ์ ํ์ด ์์ต๋๋ค:</p> <ul data-svelte-h="svelte-1ayvag1"><li>์ถ์ถํ: ์ง๋ฌธ๊ณผ ๋ฌธ๋งฅ์ด ์ฃผ์ด์ก์ ๋, ๋ชจ๋ธ์ด ์ฃผ์ด์ง ๋ฌธ๋งฅ์ ์ผ๋ถ์์ ๊ฐ์ ธ์จ ํ ์คํธ์ ๋ฒ์๋ฅผ ๋ต๋ณ์ผ๋ก ํฉ๋๋ค.</li> <li>์์ฑํ: ์ง๋ฌธ๊ณผ ๋ฌธ๋งฅ์ด ์ฃผ์ด์ก์ ๋, ์ฃผ์ด์ง ๋ฌธ๋งฅ์ ํตํด ๋ต๋ณ์ ์์ฑํฉ๋๋ค. ์ด ์ ๊ทผ ๋ฐฉ์์ <code>QuestionAnsweringPipeline</code> ๋์ <code>Text2TextGenerationPipeline</code>์ ํตํด ์ฒ๋ฆฌ๋ฉ๋๋ค.</li></ul> <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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>question_answerer = pipeline(task=<span class="hljs-string">"question-answering"</span>) | |
| <span class="hljs-meta">>>> </span>preds = question_answerer( | |
| <span class="hljs-meta">... </span> question=<span class="hljs-string">"What is the name of the repository?"</span>, | |
| <span class="hljs-meta">... </span> context=<span class="hljs-string">"The name of the repository is huggingface/transformers"</span>, | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">f"score: <span class="hljs-subst">{<span class="hljs-built_in">round</span>(preds[<span class="hljs-string">'score'</span>], <span class="hljs-number">4</span>)}</span>, start: <span class="hljs-subst">{preds[<span class="hljs-string">'start'</span>]}</span>, end: <span class="hljs-subst">{preds[<span class="hljs-string">'end'</span>]}</span>, answer: <span class="hljs-subst">{preds[<span class="hljs-string">'answer'</span>]}</span>"</span> | |
| <span class="hljs-meta">... </span>) | |
| score: <span class="hljs-number">0.9327</span>, start: <span class="hljs-number">30</span>, end: <span class="hljs-number">54</span>, answer: huggingface/transformers<!-- HTML_TAG_END --></pre></div> <h3 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>์์ฝ</span></h3> <p data-svelte-h="svelte-11gr80y">์์ฝ์ ์๋ณธ ๋ฌธ์์ ์๋ฏธ๋ฅผ ์ต๋ํ ๋ณด์กดํ๋ฉด์ ๊ธด ๋ฌธ์๋ฅผ ์งง์ ๋ฌธ์๋ก ๋ง๋๋ ์์ ์ ๋๋ค. ์์ฝ์ <code>sequence-to-sequence</code> ์์ ์ ๋๋ค. ์ ๋ ฅ๋ณด๋ค ์งง์ ํ ์คํธ ์ํ์ค๋ฅผ ์ถ๋ ฅํฉ๋๋ค. ์์ฝ ์์ ์ ๋ ์๊ฐ ์ฅ๋ฌธ ๋ฌธ์๋ค์ ์ฃผ์ ํฌ์ธํธ๋ฅผ ๋น ๋ฅด๊ฒ ์ดํดํ๋ ๋ฐ ๋์์ ์ค ์ ์์ต๋๋ค. ์ ๋ฒ์, ๋ฒ๋ฅ ๋ฐ ๊ธ์ต ๋ฌธ์, ํนํ ๋ฐ ๊ณผํ ๋ ผ๋ฌธ์ ์์ฝ ์์ ์ด ๋ ์์ ์๊ฐ์ ์ ์ฝํ๊ณ ๋ ์ ๋ณด์กฐ ๋๊ตฌ๋ก ์ฌ์ฉ๋ ์ ์๋ ๋ช ๊ฐ์ง ์์์ ๋๋ค.</p> <p data-svelte-h="svelte-fmz0j8">์ง๋ฌธ ๋ต๋ณ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ์์ฝ์๋ ๋ ๊ฐ์ง ์ ํ์ด ์์ต๋๋ค:</p> <ul data-svelte-h="svelte-mxtzg1"><li>์ถ์ถํ: ์๋ณธ ํ ์คํธ์์ ๊ฐ์ฅ ์ค์ํ ๋ฌธ์ฅ์ ์๋ณํ๊ณ ์ถ์ถํฉ๋๋ค.</li> <li>์์ฑํ: ์๋ณธ ํ ์คํธ์์ ๋ชฉํ ์์ฝ์ ์์ฑํฉ๋๋ค. ์ ๋ ฅ ๋ฌธ์์ ์๋ ์๋ก์ด ๋จ์ด๋ฅผ ํฌํจํ ์๋ ์์ต๋๋ค. <code>SummarizationPipeline</code>์ ์์ฑํ ์ ๊ทผ ๋ฐฉ์์ ์ฌ์ฉํฉ๋๋ค.</li></ul> <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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>summarizer = pipeline(task=<span class="hljs-string">"summarization"</span>) | |
| <span class="hljs-meta">>>> </span>summarizer( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"In this work, we presented the Transformer, the first sequence transduction model based entirely on attention, replacing the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention. For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers. On both WMT 2014 English-to-German and WMT 2014 English-to-French translation tasks, we achieve a new state of the art. In the former task our best model outperforms even all previously reported ensembles."</span> | |
| <span class="hljs-meta">... </span>) | |
| [{<span class="hljs-string">'summary_text'</span>: <span class="hljs-string">' The Transformer is the first sequence transduction model based entirely on attention . It replaces the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention . For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers .'</span>}]<!-- HTML_TAG_END --></pre></div> <h3 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>๋ฒ์ญ</span></h3> <p data-svelte-h="svelte-173rkq6">๋ฒ์ญ์ ํ ์ธ์ด๋ก ๋ ํ ์คํธ ์ํ์ค๋ฅผ ๋ค๋ฅธ ์ธ์ด๋ก ๋ณํํ๋ ์์ ์ ๋๋ค. ์ด๋ ์๋ก ๋ค๋ฅธ ๋ฐฐ๊ฒฝ์ ๊ฐ์ง ์ฌ๋๋ค์ด ์๋ก ์ํตํ๋ ๋ฐ ๋์์ ์ฃผ๋ ์ค์ํ ์ญํ ์ ํฉ๋๋ค. ๋ ๋์ ๋์ค์๊ฒ ์ฝํ ์ธ ๋ฅผ ๋ฒ์ญํ์ฌ ์ ๋ฌํ๊ฑฐ๋, ์๋ก์ด ์ธ์ด๋ฅผ ๋ฐฐ์ฐ๋ ๋ฐ ๋์์ด ๋๋ ํ์ต ๋๊ตฌ๊ฐ ๋ ์๋ ์์ต๋๋ค. ์์ฝ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก, ๋ฒ์ญ์ <code>sequence-to-sequence</code> ์์ ์ ๋๋ค. ์ฆ, ๋ชจ๋ธ์ ์ ๋ ฅ ์ํ์ค๋ฅผ ๋ฐ์์ ์ถ๋ ฅ์ด ๋๋ ๋ชฉํ ์ํ์ค๋ฅผ ๋ฐํํฉ๋๋ค.</p> <p data-svelte-h="svelte-4yqe8s">์ด๊ธฐ์ ๋ฒ์ญ ๋ชจ๋ธ์ ๋๋ถ๋ถ ๋จ์ผ ์ธ์ด๋ก ์ด๋ฃจ์ด์ ธ ์์์ง๋ง, ์ต๊ทผ์๋ ๋ง์ ์ธ์ด ์ ๊ฐ์ ๋ฒ์ญ์ ์ํํ ์ ์๋ ๋ค์ค ์ธ์ด ๋ชจ๋ธ์ ๋ํ ๊ด์ฌ์ด ๋์์ง๊ณ ์์ต๋๋ค.</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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>text = <span class="hljs-string">"translate English to French: Hugging Face is a community-based open-source platform for machine learning."</span> | |
| <span class="hljs-meta">>>> </span>translator = pipeline(task=<span class="hljs-string">"translation"</span>, model=<span class="hljs-string">"google-t5/t5-small"</span>) | |
| <span class="hljs-meta">>>> </span>translator(text) | |
| [{<span class="hljs-string">'translation_text'</span>: <span class="hljs-string">"Hugging Face est une tribune communautaire de l'apprentissage des machines."</span>}]<!-- HTML_TAG_END --></pre></div> <h3 class="relative group"><a id="language_modeling" 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="#language_modeling"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>์ธ์ด ๋ชจ๋ธ๋ง</span></h3> <p data-svelte-h="svelte-1i9u0s6">์ธ์ด ๋ชจ๋ธ๋ง์ ํ ์คํธ ์ํ์ค์์ ๋จ์ด๋ฅผ ์์ธกํ๋ ์์ ์ ๋๋ค. ์ฌ์ ํ๋ จ๋ ์ธ์ด ๋ชจ๋ธ์ ๋ง์ ๋ค๋ฅธ ํ์ ์์ ์ ๋ฐ๋ผ ๋ฏธ์ธ ์กฐ์ ๋ ์ ์๊ธฐ ๋๋ฌธ์ ๋งค์ฐ ์ธ๊ธฐ ์๋ ์์ฐ์ด์ฒ๋ฆฌ ์์ ์ด ๋์์ต๋๋ค. ์ต๊ทผ์๋ ์ ๋ก ์ท(zero-shot) ๋๋ ํจ ์ท(few-shot) ํ์ต์ด ๊ฐ๋ฅํ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ(Large Language Models, LLM)์ ๋ํ ๋ง์ ๊ด์ฌ์ด ๋ฐ์ํ๊ณ ์์ต๋๋ค. ์ด๋ ๋ชจ๋ธ์ด ๋ช ์์ ์ผ๋ก ํ๋ จ๋์ง ์์ ์์ ๋ ํด๊ฒฐํ ์ ์๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค! ์ธ์ด ๋ชจ๋ธ์ ์ ์ฐฝํ๊ณ ์ค๋๋ ฅ ์๋ ํ ์คํธ๋ฅผ ์์ฑํ๋ ๋ฐ ์ฌ์ฉ๋ ์ ์์ง๋ง, ํ ์คํธ๊ฐ ํญ์ ์ ํํ์ง๋ ์์ ์ ์์ผ๋ฏ๋ก ์ฃผ์๊ฐ ํ์ํฉ๋๋ค.</p> <p data-svelte-h="svelte-1pvuplr">์ธ์ด ๋ชจ๋ธ๋ง์๋ ๋ ๊ฐ์ง ์ ํ์ด ์์ต๋๋ค:</p> <ul><li><p data-svelte-h="svelte-bmp22e">์ธ๊ณผ์ ์ธ์ด ๋ชจ๋ธ๋ง: ์ด ๋ชจ๋ธ์ ๋ชฉ์ ์ ์ํ์ค์์ ๋ค์ ํ ํฐ์ ์์ธกํ๋ ๊ฒ์ด๋ฉฐ, ๋ฏธ๋ ํ ํฐ์ด ๋ง์คํน ๋ฉ๋๋ค.</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-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"Hugging Face is a community-based open-source platform for machine learning."</span> | |
| <span class="hljs-meta">>>> </span>generator = pipeline(task=<span class="hljs-string">"text-generation"</span>) | |
| <span class="hljs-meta">>>> </span>generator(prompt) <span class="hljs-comment"># doctest: +SKIP</span><!-- HTML_TAG_END --></pre></div></li> <li><p data-svelte-h="svelte-axjjse">๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ๋ง: ์ด ๋ชจ๋ธ์ ๋ชฉ์ ์ ์ํ์ค ๋ด์ ๋ง์คํน๋ ํ ํฐ์ ์์ธกํ๋ ๊ฒ์ด๋ฉฐ, ์ํ์ค ๋ด์ ๋ชจ๋ ํ ํฐ์ ๋ํ ์ ๊ทผ์ด ์ ๊ณต๋ฉ๋๋ค.</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-meta">>>> </span>text = <span class="hljs-string">"Hugging Face is a community-based open-source <mask> for machine learning."</span> | |
| <span class="hljs-meta">>>> </span>fill_mask = pipeline(task=<span class="hljs-string">"fill-mask"</span>) | |
| <span class="hljs-meta">>>> </span>preds = fill_mask(text, top_k=<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span>preds = [ | |
| <span class="hljs-meta">... </span> { | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"score"</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">"score"</span>], <span class="hljs-number">4</span>), | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"token"</span>: pred[<span class="hljs-string">"token"</span>], | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"token_str"</span>: pred[<span class="hljs-string">"token_str"</span>], | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"sequence"</span>: pred[<span class="hljs-string">"sequence"</span>], | |
| <span class="hljs-meta">... </span> } | |
| <span class="hljs-meta">... </span> <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds | |
| <span class="hljs-meta">... </span>] | |
| <span class="hljs-meta">>>> </span>preds | |
| [{<span class="hljs-string">'score'</span>: <span class="hljs-number">0.2236</span>, | |
| <span class="hljs-string">'token'</span>: <span class="hljs-number">1761</span>, | |
| <span class="hljs-string">'token_str'</span>: <span class="hljs-string">' platform'</span>, | |
| <span class="hljs-string">'sequence'</span>: <span class="hljs-string">'Hugging Face is a community-based open-source platform for machine learning.'</span>}]<!-- HTML_TAG_END --></pre></div></li></ul> <p data-svelte-h="svelte-sjudlh">์ด ํ์ด์ง๋ฅผ ํตํด ๊ฐ ๋ชจ๋ฌ๋ฆฌํฐ์ ๋ค์ํ ์์ ์ ํ๊ณผ ๊ฐ ์์ ์ ์ค์ฉ์ ์ค์์ฑ์ ๋ํด ์ถ๊ฐ์ ์ธ ๋ฐฐ๊ฒฝ ์ ๋ณด๋ฅผ ์ป์ผ์ จ๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ๋ค์ <a href="tasks_explained">์น์ </a>์์๋ ๐ค Transformer๊ฐ ์ด๋ฌํ ์์ ์ ํด๊ฒฐํ๋ <strong>๋ฐฉ๋ฒ</strong>์ ๋ํด ์์๋ณด์ค ์ ์์ต๋๋ค.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/transformers/blob/main/docs/source/ko/task_summary.md" 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_1hrx8 = { | |
| assets: "/docs/transformers/main/ko", | |
| base: "/docs/transformers/main/ko", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/transformers/main/ko/_app/immutable/entry/start.9aa88961.js"), | |
| import("/docs/transformers/main/ko/_app/immutable/entry/app.84fb67c3.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 60], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 79.3 kB
- Xet hash:
- 250e9d0e1dfe66ff1bbfcb7eef80331cd34c5f03fe1bf257deaba0c269a71fb2
ยท
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.