import{s as _n,c as Hn,u as Dn,g as Pn,d as Kn,e as On,h as gn,o as xn,n as Bl}from"../chunks/scheduler.36a0863c.js";import{S as Ln,i as zn,g as w,s as y,h,j as Kl,f as n,c as u,k as Dl,a,d as I,t as d,z as la,m as S,n as E,y as dn,C as na,o as aa,r as k,A as ea,u as f,x as C,v as B,w as W}from"../chunks/index.156fee99.js";import{T as In}from"../chunks/Tip.8a648467.js";import{C as N}from"../chunks/CodeBlock.4cf998e6.js";import{H as Tl,E as sa}from"../chunks/getInferenceSnippets.472bc46d.js";import{e as Xn}from"../chunks/each.e59479a4.js";import{s as bn}from"../chunks/stores.8f4efe8a.js";function ta(Z,r){const i=new URL(window.location.href),j=new URLSearchParams(i.search);j.set(Z,r),i.search=j.toString(),history.replaceState(null,"",i.toString())}function Ma(Z){const r=new URL(window.location.href);return new URLSearchParams(r.search).get(Z)}function Fn(Z,r,i){const j=Z.slice();return j[7]=r[i],j}function qn(Z){let r,i=Z[7]+"",j,c,U,J,M;function o(){return Z[6](Z[7])}return{c(){r=w("div"),j=S(i),c=y(),this.h()},l(m){r=h(m,"DIV",{class:!0});var p=Kl(r);j=E(p,i),c=u(p),p.forEach(n),this.h()},h(){Dl(r,"class",U="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd "+(Z[2][Z[0]]===Z[7]?"border-gray-800 bg-black dark:bg-gray-700 text-white":"text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm"))},m(m,p){a(m,r,p),dn(r,j),dn(r,c),J||(M=na(r,"click",o),J=!0)},p(m,p){Z=m,p&2&&i!==(i=Z[7]+"")&&aa(j,i),p&7&&U!==(U="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd "+(Z[2][Z[0]]===Z[7]?"border-gray-800 bg-black dark:bg-gray-700 text-white":"text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm"))&&Dl(r,"class",U)},d(m){m&&n(r),J=!1,M()}}}function pa(Z){let r,i,j,c,U=Xn(Z[1]),J=[];for(let m=0;m<U.length;m+=1)J[m]=qn(Fn(Z,U,m));const M=Z[5].default,o=Hn(M,Z,Z[4],null);return{c(){r=w("div");for(let m=0;m<J.length;m+=1)J[m].c();i=y(),j=w("div"),o&&o.c(),this.h()},l(m){r=h(m,"DIV",{class:!0});var p=Kl(r);for(let A=0;A<J.length;A+=1)J[A].l(p);p.forEach(n),i=u(m),j=h(m,"DIV",{class:!0});var G=Kl(j);o&&o.l(G),G.forEach(n),this.h()},h(){Dl(r,"class","flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"),Dl(j,"class","language-select")},m(m,p){a(m,r,p);for(let G=0;G<J.length;G+=1)J[G]&&J[G].m(r,null);a(m,i,p),a(m,j,p),o&&o.m(j,null),c=!0},p(m,[p]){if(p&15){U=Xn(m[1]);let G;for(G=0;G<U.length;G+=1){const A=Fn(m,U,G);J[G]?J[G].p(A,p):(J[G]=qn(A),J[G].c(),J[G].m(r,null))}for(;G<J.length;G+=1)J[G].d(1);J.length=U.length}o&&o.p&&(!c||p&16)&&Dn(o,M,m,m[4],c?Kn(M,m[4],p,null):Pn(m[4]),null)},i(m){c||(I(o,m),c=!0)},o(m){d(o,m),c=!1},d(m){m&&(n(r),n(i),n(j)),la(J,m),o&&o.d(m)}}}function ia(Z,r,i){let j;On(Z,bn,p=>i(2,j=p));let{$$slots:c={},$$scope:U}=r,{id:J}=r,{options:M}=r;gn(bn,j[J]=M[0],j);function o(p){gn(bn,j[J]=p,j),ta(J,p)}xn(()=>{const p=Ma(J);p&&M.includes(p)&&gn(bn,j[J]=p,j)});const m=p=>o(p);return Z.$$set=p=>{"id"in p&&i(0,J=p.id),"options"in p&&i(1,M=p.options),"$$scope"in p&&i(4,U=p.$$scope)},[J,M,j,o,U,c,m]}class Hl extends Ln{constructor(r){super(),zn(this,r,ia,pa,_n,{id:0,options:1})}}function ma(Z){let r,i,j="Inovasi utama terletak pada cara mengelola transfer memori antara High Bandwidth Memory (HBM) dan cache SRAM yang lebih cepat. Attention tradisional berulang kali mentransfer data antara HBM dan SRAM, menciptakan hambatan dan membuat GPU tidak aktif. Flash Attention memuat data sekali ke SRAM dan melakukan semua perhitungan di sana, meminimalkan transfer memori yang mahal.",c,U,J="Meskipun manfaatnya paling besar saat pelatihan, penggunaan VRAM yang lebih rendah dan efisiensi Flash Attention juga sangat berguna saat inferensi, memungkinkan penyajian LLM yang lebih cepat dan skalabel.";return{c(){r=S(`Flash Attention adalah teknik yang mengoptimalkan mekanisme attention dalam model transformer dengan mengatasi hambatan bandwidth memori. Seperti yang dibahas dalam [Bab 1.8](/course/chapter1/8), mekanisme attention memiliki kompleksitas kuadrat dan penggunaan memori yang tinggi, sehingga tidak efisien untuk urutan panjang.
`),i=w("p"),i.textContent=j,c=y(),U=w("p"),U.textContent=J},l(M){r=E(M,`Flash Attention adalah teknik yang mengoptimalkan mekanisme attention dalam model transformer dengan mengatasi hambatan bandwidth memori. Seperti yang dibahas dalam [Bab 1.8](/course/chapter1/8), mekanisme attention memiliki kompleksitas kuadrat dan penggunaan memori yang tinggi, sehingga tidak efisien untuk urutan panjang.
`),i=h(M,"P",{"data-svelte-h":!0}),C(i)!=="svelte-jfygbi"&&(i.textContent=j),c=u(M),U=h(M,"P",{"data-svelte-h":!0}),C(U)!=="svelte-w41pqe"&&(U.textContent=J)},m(M,o){a(M,r,o),a(M,i,o),a(M,c,o),a(M,U,o)},p:Bl,d(M){M&&(n(r),n(i),n(c),n(U))}}}function ya(Z){let r,i,j="Inovasi utama vLLM adalah:",c,U,J="<li><strong>Memory Paging</strong>: KV cache dibagi menjadi “halaman” berukuran tetap (seperti virtual memory).</li> <li><strong>Penyimpanan Non-Kontigu</strong>: Halaman tidak harus tersimpan secara berurutan di memori GPU.</li> <li><strong>Manajemen Tabel Halaman</strong>: Tabel halaman melacak halaman mana milik urutan mana, memungkinkan akses efisien.</li> <li><strong>Berbagi Memori</strong>: Untuk operasi seperti sampling paralel, halaman KV cache dapat dibagi antara banyak urutan.</li>",M,o,m='PagedAttention meningkatkan throughput hingga 24x dibandingkan metode tradisional — sangat signifikan untuk produksi. Untuk detail lebih lanjut, lihat <a href="https://docs.vllm.ai/en/latest/design/kernel/paged_attention.html" rel="nofollow">panduan vLLM</a>.';return{c(){r=S(`PagedAttention adalah teknik yang mengatasi hambatan kritis dalam inferensi LLM: manajemen memori KV cache. Seperti yang dijelaskan di [Bab 1.8](/course/chapter1/8), saat menghasilkan teks, model menyimpan key dan value attention (KV cache) untuk setiap token yang dihasilkan agar menghindari perhitungan ulang. KV cache dapat menjadi sangat besar, terutama untuk urutan panjang atau banyak permintaan secara bersamaan.
`),i=w("p"),i.textContent=j,c=y(),U=w("ol"),U.innerHTML=J,M=y(),o=w("p"),o.innerHTML=m},l(p){r=E(p,`PagedAttention adalah teknik yang mengatasi hambatan kritis dalam inferensi LLM: manajemen memori KV cache. Seperti yang dijelaskan di [Bab 1.8](/course/chapter1/8), saat menghasilkan teks, model menyimpan key dan value attention (KV cache) untuk setiap token yang dihasilkan agar menghindari perhitungan ulang. KV cache dapat menjadi sangat besar, terutama untuk urutan panjang atau banyak permintaan secara bersamaan.
`),i=h(p,"P",{"data-svelte-h":!0}),C(i)!=="svelte-xmmut3"&&(i.textContent=j),c=u(p),U=h(p,"OL",{"data-svelte-h":!0}),C(U)!=="svelte-ol7u5q"&&(U.innerHTML=J),M=u(p),o=h(p,"P",{"data-svelte-h":!0}),C(o)!=="svelte-121342p"&&(o.innerHTML=m)},m(p,G){a(p,r,G),a(p,i,G),a(p,c,G),a(p,U,G),a(p,M,G),a(p,o,G)},p:Bl,d(p){p&&(n(r),n(i),n(c),n(U),n(M),n(o))}}}function ua(Z){let r,i,j="Fitur kuantisasi utama di llama.cpp:",c,U,J="<li><strong>Banyak Tingkat Kuantisasi</strong>: Mendukung kuantisasi 8-bit, 4-bit, 3-bit, hingga 2-bit</li> <li><strong>Format GGML/GGUF</strong>: Format tensor khusus yang dioptimalkan untuk inferensi kuantisasi</li> <li><strong>Presisi Campuran</strong>: Bisa menerapkan tingkat kuantisasi berbeda di bagian berbeda dari model</li> <li><strong>Optimasi Perangkat Keras</strong>: Kode dioptimalkan untuk berbagai arsitektur CPU (AVX2, AVX-512, NEON)</li>",M,o,m="Pendekatan ini memungkinkan model dengan miliaran parameter dijalankan di perangkat konsumen dengan memori terbatas — sangat cocok untuk deployment lokal dan perangkat edge.";return{c(){r=S(`Kuantisasi di llama.cpp menurunkan presisi bobot model dari 32-bit atau 16-bit float menjadi format yang lebih rendah seperti INT8 (8-bit), 4-bit, atau bahkan lebih kecil. Ini secara signifikan mengurangi penggunaan memori dan mempercepat inferensi tanpa kehilangan kualitas secara signifikan.
`),i=w("p"),i.textContent=j,c=y(),U=w("ol"),U.innerHTML=J,M=y(),o=w("p"),o.textContent=m},l(p){r=E(p,`Kuantisasi di llama.cpp menurunkan presisi bobot model dari 32-bit atau 16-bit float menjadi format yang lebih rendah seperti INT8 (8-bit), 4-bit, atau bahkan lebih kecil. Ini secara signifikan mengurangi penggunaan memori dan mempercepat inferensi tanpa kehilangan kualitas secara signifikan.
`),i=h(p,"P",{"data-svelte-h":!0}),C(i)!=="svelte-n3qf0l"&&(i.textContent=j),c=u(p),U=h(p,"OL",{"data-svelte-h":!0}),C(U)!=="svelte-oix722"&&(U.innerHTML=J),M=u(p),o=h(p,"P",{"data-svelte-h":!0}),C(o)!=="svelte-1jcow5m"&&(o.textContent=m)},m(p,G){a(p,r,G),a(p,i,G),a(p,c,G),a(p,U,G),a(p,M,G),a(p,o,G)},p:Bl,d(p){p&&(n(r),n(i),n(c),n(U),n(M),n(o))}}}function ra(Z){let r,i,j="TGI mudah dipasang dan digunakan, dengan integrasi mendalam ke ekosistem Hugging Face.",c,U,J="Pertama, jalankan server TGI menggunakan Docker:",M,o,m,p,G="Lalu berinteraksi dengannya menggunakan <code>InferenceClient</code> dari Hugging Face:",A,R,H,Q,ul="Alternatif lain, gunakan klien OpenAI:",v,X,D,V,rl="llama.cpp mudah dipasang dan digunakan, hanya membutuhkan dependensi minimal dan mendukung inferensi via CPU dan GPU.",Y,T,$="Pertama, instal dan bangun <code>llama.cpp</code>:",nl,F,al,P,gl="Lalu jalankan server-nya:",el,q,sl,K,Il="Gunakan <code>InferenceClient</code> untuk mengaksesnya:",tl,_,Ml,O,jl="Atau gunakan klien OpenAI:",x,Ul,pl,ll,dl="vLLM mudah dipasang, dengan kompatibilitas API OpenAI dan antarmuka Python bawaan.",il,L,cl="Jalankan server API vLLM:",wl,z,Jl,ml,ol="Lalu berinteraksilah dengannya menggunakan <code>InferenceClient</code> dari Hugging Face:",s,b,Vl,hl,Cl="Atau dengan klien OpenAI:",kl,yl,fl,bl;return o=new N({props:{code:"ZG9ja2VyJTIwcnVuJTIwLS1ncHVzJTIwYWxsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zaG0tc2l6ZSUyMDFnJTIwJTVDJTBBJTIwJTIwJTIwJTIwLXAlMjA4MDgwJTNBODAlMjAlNUMlMEElMjAlMjAlMjAlMjAtdiUyMH4lMkYuY2FjaGUlMkZodWdnaW5nZmFjZSUzQSUyRmRhdGElMjAlNUMlMEElMjAlMjAlMjAlMjBnaGNyLmlvJTJGaHVnZ2luZ2ZhY2UlMkZ0ZXh0LWdlbmVyYXRpb24taW5mZXJlbmNlJTNBbGF0ZXN0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbC1pZCUyMEh1Z2dpbmdGYWNlVEIlMkZTbW9sTE0yLTM2ME0tSW5zdHJ1Y3Q=",highlighted:`docker run --gpus all \\
    --shm-size 1g \\
    -p 8080:80 \\
    -v ~/.cache/huggingface:/data \\
    ghcr.io/huggingface/text-generation-inference:latest \\
    --model-id HuggingFaceTB/SmolLM2-360M-Instruct`,wrap:!1}}),R=new N({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEluZmVyZW5jZUNsaWVudCUwQSUwQWNsaWV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1RCUyQyUwQSUyMCUyMCUyMCUyMG1heF90b2tlbnMlM0QxMDAlMkMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDAuNyUyQyUwQSUyMCUyMCUyMCUyMHRvcF9wJTNEMC45NSUyQyUwQSklMEFwcmludChyZXNwb25zZS5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlLmNvbnRlbnQp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient

client = InferenceClient(
    model=<span class="hljs-string">&quot;http://localhost:8080&quot;</span>,  <span class="hljs-comment"># URL untuk server TGI</span>
)

response = client.text_generation(
    <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>,
    max_new_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
    details=<span class="hljs-literal">True</span>,
    stop_sequences=[],
)
<span class="hljs-built_in">print</span>(response.generated_text)

response = client.chat_completion(
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah asisten yang membantu.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>},
    ],
    max_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),X=new N({props:{code:"ZnJvbSUyMG9wZW5haSUyMGltcG9ydCUyME9wZW5BSSUwQSUwQWNsaWVudCUyMCUzRCUyME9wZW5BSSglMEElMjAlMjAlMjAlMjBiYXNlX3VybCUzRCUyMmh0dHAlM0ElMkYlMkZsb2NhbGhvc3QlM0E4MDgwJTJGdjElMjIlMkMlMjAlMjAlMjMlMjBQYXN0aWthbiUyMG1lbnllcnRha2FuJTIwJTJGdjElMEElMjAlMjAlMjAlMjBhcGlfa2V5JTNEJTIybm90LW5lZWRlZCUyMiUyQyUyMCUyMCUyMyUyMFNlY2FyYSUyMGRlZmF1bHQlMkMlMjBUR0klMjB0aWRhayUyMG1lbWVybHVrYW4lMjBBUEklMjBrZXklMEEpJTBBJTBBcmVzcG9uc2UlMjAlM0QlMjBjbGllbnQuY2hhdC5jb21wbGV0aW9ucy5jcmVhdGUoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0QlMjJIdWdnaW5nRmFjZVRCJTJGU21vbExNMi0zNjBNLUluc3RydWN0JTIyJTJDJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlM0QlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkthbXUlMjBhZGFsYWglMjBhc2lzdGVuJTIweWFuZyUyMG1lbWJhbnR1LiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkNlcml0YWthbiUyMHNlYnVhaCUyMGtpc2FoJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwbWF4X3Rva2VucyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC43JTJDJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjk1JTJDJTBBKSUwQXByaW50KHJlc3BvbnNlLmNob2ljZXMlNUIwJTVELm1lc3NhZ2UuY29udGVudCk=",highlighted:`<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI

client = OpenAI(
    base_url=<span class="hljs-string">&quot;http://localhost:8080/v1&quot;</span>,  <span class="hljs-comment"># Pastikan menyertakan /v1</span>
    api_key=<span class="hljs-string">&quot;not-needed&quot;</span>,  <span class="hljs-comment"># Secara default, TGI tidak memerlukan API key</span>
)

response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;HuggingFaceTB/SmolLM2-360M-Instruct&quot;</span>,
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah asisten yang membantu.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>},
    ],
    max_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),F=new N({props:{code:"JTIzJTIwS2xvbiUyMHJlcG9zaXRvcmklMEFnaXQlMjBjbG9uZSUyMGh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmdnZXJnYW5vdiUyRmxsYW1hLmNwcCUwQWNkJTIwbGxhbWEuY3BwJTBBJTBBJTIzJTIwQnVpbGQlMjBwcm9qZWN0JTBBbWFrZSUwQSUwQSUyMyUyMERvd25sb2FkJTIwbW9kZSUyMFNtb2xMTTItMS43Qi1JbnN0cnVjdC1HR1VGJTIwJTBBY3VybCUyMC1MJTIwLU8lMjBodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGSHVnZ2luZ0ZhY2VUQiUyRlNtb2xMTTItMS43Qi1JbnN0cnVjdC1HR1VGJTJGcmVzb2x2ZSUyRm1haW4lMkZzbW9sbG0yLTEuN2ItaW5zdHJ1Y3QuUTRfS19NLmdndWY=",highlighted:`<span class="hljs-comment"># Klon repositori</span>
git <span class="hljs-built_in">clone</span> https://github.com/ggerganov/llama.cpp
<span class="hljs-built_in">cd</span> llama.cpp

<span class="hljs-comment"># Build project</span>
make

<span class="hljs-comment"># Download mode SmolLM2-1.7B-Instruct-GGUF </span>
curl -L -O https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct-GGUF/resolve/main/smollm2-1.7b-instruct.Q4_K_M.gguf`,wrap:!1}}),q=new N({props:{code:"JTIzJTIwTWVuamFsYW5rYW4lMjBzZXJ2ZXIlMEEuJTJGc2VydmVyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLW0lMjBzbW9sbG0yLTEuN2ItaW5zdHJ1Y3QuUTRfS19NLmdndWYlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWhvc3QlMjAwLjAuMC4wJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wb3J0JTIwODA4MCUyMCU1QyUwQSUyMCUyMCUyMCUyMC1jJTIwNDA5NiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbi1ncHUtbGF5ZXJzJTIwMCUyMCUyMCUyMCUyMyUyMEF0dXIlMjBrZSUyMGFuZ2thJTIwbGViaWglMjB0aW5nZ2klMjB1bnR1ayUyMG1lbmdndW5ha2FuJTIwR1BV",highlighted:`<span class="hljs-comment"># Menjalankan server</span>
./server \\
    -m smollm2-1.7b-instruct.Q4_K_M.gguf \\
    --host 0.0.0.0 \\
    --port 8080 \\
    -c 4096 \\
    --n-gpu-layers 0   <span class="hljs-comment"># Atur ke angka lebih tinggi untuk menggunakan GPU</span>`,wrap:!1}}),_=new N({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEluZmVyZW5jZUNsaWVudCUwQSUwQSUyMyUyMEluaXNpYWxpc2FzaSUyMGtsaWVuJTIweWFuZyUyMG1lbmdhcmFoJTIwa2UlMjBzZXJ2ZXIlMjBsbGFtYS5jcHAlMEFjbGllbnQlMjAlM0QlMjBJbm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TIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMjAlMjJjb250ZW50JTIyJTNBJTIwJTIyQ2VyaXRha2FuJTIwc2VidWFoJTIwa2lzYWglMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjBtYXhfdG9rZW5zJTNEMTAwJTJDJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QwLjclMkMlMEElMjAlMjAlMjAlMjB0b3BfcCUzRDAuOTUlMkMlMEEpJTBBcHJpbnQocmVzcG9uc2UuY2hvaWNlcyU1QjAlNUQubWVzc2FnZS5jb250ZW50KQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient

<span class="hljs-comment"># Inisialisasi klien yang mengarah ke server llama.cpp</span>
client = InferenceClient(
    model=<span class="hljs-string">&quot;http://localhost:8080/v1&quot;</span>,  <span class="hljs-comment"># URL untuk server llama.cpp</span>
    token=<span class="hljs-string">&quot;sk-no-key-required&quot;</span>,  <span class="hljs-comment"># server llama.cpp memerlukan placeholder ini</span>
)

<span class="hljs-comment"># Pembuatan teks</span>
response = client.text_generation(
    <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>,
    max_new_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
    details=<span class="hljs-literal">True</span>,
)

<span class="hljs-built_in">print</span>(response.generated_text)

<span class="hljs-comment"># Untuk format percakapan</span>
response = client.chat_completion(
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah asisten yang membantu.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>},
    ],
    max_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),Ul=new N({props:{code:"ZnJvbSUyMG9wZW5haSUyMGltcG9ydCUyME9wZW5BSSUwQSUwQSUyMyUyMEluaXNpYWxpc2FzaSUyMGtsaWVuJTIweWFuZyUyMG1lbnVuanVrJTIwa2UlMjBzZXJ2ZXIlMjBsbGFtYS5jcHAlMEFjbGllbnQlMjAlM0QlMjBPcGVuQUkoJTBBJTIwJTIwJTIwJTIwYmFzZV91cmwlM0QlMjJodHRwJTNBJTJGJTJGbG9jYWxob3N0JTNBODA4MCUyRnYxJTIyJTJDJTBBJTIwJTIwJTIwJTIwYXBpX2tleSUzRCUyMnNrLW5vLWtleS1yZXF1aXJlZCUyMiUyQyUyMCUyMCUyMyUyMHNlcnZlciUyMGxsYW1hLmNwcCUyMG1lbWVybHVrYW4lMjBwbGFjZWhvbGRlciUyMGluaSUwQSklMEElMEFyZXNwb25zZSUyMCUzRCUyMGNsaWVudC5jaGF0LmNvbXBsZXRpb25zLmNyZWF0ZSglMEElMjAlMjAlMjAlMjBtb2RlbCUzRCUyMnNtb2xsbTItMS43Yi1pbnN0cnVjdCUyMiUyQyUyMCUyMCUyMyUyMFBlbmdlbmFsJTIwbW9kZWwlMjBiaXNhJTIwYXBhJTIwc2FqYSUyMGthcmVuYSUyMHNlcnZlciUyMGhhbnlhJTIwbWVtdWF0JTIwc2F0dSUyMG1vZGVsJTBBJTIwJTIwJTIwJTIwbWVzc2FnZXMlM0QlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIyc3lzdGVtJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkthbXUlMjBhZGFsYWglMjBhc2lzdGVuJTIweWFuZyUyMG1lbWJhbnR1LiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkNlcml0YWthbiUyMHNlYnVhaCUyMGtpc2FoJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwbWF4X3Rva2VucyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC43JTJDJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjk1JTJDJTBBKSUwQXByaW50KHJlc3BvbnNlLmNob2ljZXMlNUIwJTVELm1lc3NhZ2UuY29udGVudCk=",highlighted:`<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI

<span class="hljs-comment"># Inisialisasi klien yang menunjuk ke server llama.cpp</span>
client = OpenAI(
    base_url=<span class="hljs-string">&quot;http://localhost:8080/v1&quot;</span>,
    api_key=<span class="hljs-string">&quot;sk-no-key-required&quot;</span>,  <span class="hljs-comment"># server llama.cpp memerlukan placeholder ini</span>
)

response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;smollm2-1.7b-instruct&quot;</span>,  <span class="hljs-comment"># Pengenal model bisa apa saja karena server hanya memuat satu model</span>
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah asisten yang membantu.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>},
    ],
    max_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),z=new N({props:{code:"cHl0aG9uJTIwLW0lMjB2bGxtLmVudHJ5cG9pbnRzLm9wZW5haS5hcGlfc2VydmVyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbCUyMEh1Z2dpbmdGYWNlVEIlMkZTbW9sTE0yLTM2ME0tSW5zdHJ1Y3QlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWhvc3QlMjAwLjAuMC4wJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wb3J0JTIwODAwMA==",highlighted:`python -m vllm.entrypoints.openai.api_server \\
    --model HuggingFaceTB/SmolLM2-360M-Instruct \\
    --host 0.0.0.0 \\
    --port 8000`,wrap:!1}}),b=new N({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEluZmVyZW5jZUNsaWVudCUwQSUwQSUyMyUyMEluaXNpYWxpc2FzaSUyMGtsaWVuJTIweWFuZyUyMG1lbnVuanVrJTIwa2UlMjBlbmRwb2ludCUyMHZMTE0lMEFjbGllbnQlMjAlM0QlMjBJbmZlcmVuY2VDbGllbnQoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0QlMjJodHRwJTNBJTJGJTJGbG9jYWxob3N0JTNBODAwMCUyRnYxJTIyJTJDJTIwJTIwJTIzJTIwVVJMJTIwdW50dWslMjBzZXJ2ZXIlMjB2TExNJTBBKSUwQSUwQSUyMyUyMFBlbWJ1YXRhbiUyMHRla3MlMEFyZXNwb25zZSUyMCUzRCUyMGNsaWVudC50ZXh0X2dlbmVyYXRpb24oJTBBJTIwJTIwJTIwJTIwJTIyQ2VyaXRha2FuJTIwc2VidWFoJTIwa2lzYWglMjIlMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC43JTJDJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjk1JTJDJTBBJTIwJTIwJTIwJTIwZGV0YWlscyUzRFRydWUlMkMlMEEpJTBBcHJpbnQocmVzcG9uc2UuZ2VuZXJhdGVkX3RleHQpJTBBJTBBJTIzJTIwVW50dWslMjBmb3JtYXQlMjBwZXJjYWthcGFuJTBBcmVzcG9uc2UlMjAlM0QlMjBjbGllbnQuY2hhdF9jb21wbGV0aW9uKCUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNEJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnN5c3RlbSUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJLYW11JTIwYWRhbGFoJTIwYXNpc3RlbiUyMHlhbmclMjBtZW1iYW50dS4lMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJDZXJpdGFrYW4lMjBzZWJ1YWglMjBraXNhaCUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMG1heF90b2tlbnMlM0QxMDAlMkMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDAuNyUyQyUwQSUyMCUyMCUyMCUyMHRvcF9wJTNEMC45NSUyQyUwQSklMEFwcmludChyZXNwb25zZS5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlLmNvbnRlbnQp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient

<span class="hljs-comment"># Inisialisasi klien yang menunjuk ke endpoint vLLM</span>
client = InferenceClient(
    model=<span class="hljs-string">&quot;http://localhost:8000/v1&quot;</span>,  <span class="hljs-comment"># URL untuk server vLLM</span>
)

<span class="hljs-comment"># Pembuatan teks</span>
response = client.text_generation(
    <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>,
    max_new_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
    details=<span class="hljs-literal">True</span>,
)
<span class="hljs-built_in">print</span>(response.generated_text)

<span class="hljs-comment"># Untuk format percakapan</span>
response = client.chat_completion(
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah asisten yang membantu.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>},
    ],
    max_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),yl=new N({props:{code:"ZnJvbSUyMG9wZW5haSUyMGltcG9ydCUyME9wZW5BSSUwQSUwQSUyMyUyMEluaXNpYWxpc2FzaSUyMGtsaWVuJTIweWFuZyUyMG1lbmdhcmFoJTIwa2UlMjBlbmRwb2ludCUyMHZMTE0lMEFjbGllbnQlMjAlM0QlMjBPcGVuQUkoJTBBJTIwJTIwJTIwJTIwYmFzZV91cmwlM0QlMjJodHRwJTNBJTJGJTJGbG9jYWxob3N0JTNBODAwMCUyRnYxJTIyJTJDJTBBJTIwJTIwJTIwJTIwYXBpX2tleSUzRCUyMm5vdC1uZWVkZWQlMjIlMkMlMjAlMjAlMjMlMjBTZWNhcmElMjBiYXdhYW4lMkMlMjB2TExNJTIwdGlkYWslMjBtZW1lcmx1a2FuJTIwQVBJJTIwa2V5JTBBKSUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LmNoYXQuY29tcGxldGlvbnMuY3JlYXRlKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEJTIySHVnZ2luZ0ZhY2VUQiUyRlNtb2xMTTItMzYwTS1JbnN0cnVjdCUyMiUyQyUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNEJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnN5c3RlbSUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJLYW11JTIwYWRhbGFoJTIwYXNpc3RlbiUyMHlhbmclMjBtZW1iYW50dS4lMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJDZXJpdGFrYW4lMjBzZWJ1YWglMjBraXNhaCUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMG1heF90b2tlbnMlM0QxMDAlMkMlMEElMjAlMjAlMjAlMjB0ZW1wZXJhdHVyZSUzRDAuNyUyQyUwQSUyMCUyMCUyMCUyMHRvcF9wJTNEMC45NSUyQyUwQSklMEFwcmludChyZXNwb25zZS5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlLmNvbnRlbnQp",highlighted:`<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI

<span class="hljs-comment"># Inisialisasi klien yang mengarah ke endpoint vLLM</span>
client = OpenAI(
    base_url=<span class="hljs-string">&quot;http://localhost:8000/v1&quot;</span>,
    api_key=<span class="hljs-string">&quot;not-needed&quot;</span>,  <span class="hljs-comment"># Secara bawaan, vLLM tidak memerlukan API key</span>
)

response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;HuggingFaceTB/SmolLM2-360M-Instruct&quot;</span>,
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah asisten yang membantu.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Ceritakan sebuah kisah&quot;</span>},
    ],
    max_tokens=<span class="hljs-number">100</span>,
    temperature=<span class="hljs-number">0.7</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),{c(){r=S(`<hfoption value="tgi" label="TGI">
`),i=w("p"),i.textContent=j,c=y(),U=w("p"),U.textContent=J,M=y(),k(o.$$.fragment),m=y(),p=w("p"),p.innerHTML=G,A=y(),k(R.$$.fragment),H=y(),Q=w("p"),Q.textContent=ul,v=y(),k(X.$$.fragment),D=S(`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">
`),V=w("p"),V.textContent=rl,Y=y(),T=w("p"),T.innerHTML=$,nl=y(),k(F.$$.fragment),al=y(),P=w("p"),P.textContent=gl,el=y(),k(q.$$.fragment),sl=y(),K=w("p"),K.innerHTML=Il,tl=y(),k(_.$$.fragment),Ml=y(),O=w("p"),O.textContent=jl,x=y(),k(Ul.$$.fragment),pl=S(`
</hfoption>
<hfoption value="vllm" label="vLLM">
`),ll=w("p"),ll.textContent=dl,il=y(),L=w("p"),L.textContent=cl,wl=y(),k(z.$$.fragment),Jl=y(),ml=w("p"),ml.innerHTML=ol,s=y(),k(b.$$.fragment),Vl=y(),hl=w("p"),hl.textContent=Cl,kl=y(),k(yl.$$.fragment),fl=S(`
</hfoption>`)},l(e){r=E(e,`<hfoption value="tgi" label="TGI">
`),i=h(e,"P",{"data-svelte-h":!0}),C(i)!=="svelte-1wo0s27"&&(i.textContent=j),c=u(e),U=h(e,"P",{"data-svelte-h":!0}),C(U)!=="svelte-l3djch"&&(U.textContent=J),M=u(e),f(o.$$.fragment,e),m=u(e),p=h(e,"P",{"data-svelte-h":!0}),C(p)!=="svelte-1l3gnvv"&&(p.innerHTML=G),A=u(e),f(R.$$.fragment,e),H=u(e),Q=h(e,"P",{"data-svelte-h":!0}),C(Q)!=="svelte-17ivk84"&&(Q.textContent=ul),v=u(e),f(X.$$.fragment,e),D=E(e,`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">
`),V=h(e,"P",{"data-svelte-h":!0}),C(V)!=="svelte-1bx6ztg"&&(V.textContent=rl),Y=u(e),T=h(e,"P",{"data-svelte-h":!0}),C(T)!=="svelte-rsihho"&&(T.innerHTML=$),nl=u(e),f(F.$$.fragment,e),al=u(e),P=h(e,"P",{"data-svelte-h":!0}),C(P)!=="svelte-1ltsiwy"&&(P.textContent=gl),el=u(e),f(q.$$.fragment,e),sl=u(e),K=h(e,"P",{"data-svelte-h":!0}),C(K)!=="svelte-bqx66v"&&(K.innerHTML=Il),tl=u(e),f(_.$$.fragment,e),Ml=u(e),O=h(e,"P",{"data-svelte-h":!0}),C(O)!=="svelte-1t7u5oh"&&(O.textContent=jl),x=u(e),f(Ul.$$.fragment,e),pl=E(e,`
</hfoption>
<hfoption value="vllm" label="vLLM">
`),ll=h(e,"P",{"data-svelte-h":!0}),C(ll)!=="svelte-15eyqaq"&&(ll.textContent=dl),il=u(e),L=h(e,"P",{"data-svelte-h":!0}),C(L)!=="svelte-2eicno"&&(L.textContent=cl),wl=u(e),f(z.$$.fragment,e),Jl=u(e),ml=h(e,"P",{"data-svelte-h":!0}),C(ml)!=="svelte-1ltue7k"&&(ml.innerHTML=ol),s=u(e),f(b.$$.fragment,e),Vl=u(e),hl=h(e,"P",{"data-svelte-h":!0}),C(hl)!=="svelte-1g7zqpn"&&(hl.textContent=Cl),kl=u(e),f(yl.$$.fragment,e),fl=E(e,`
</hfoption>`)},m(e,g){a(e,r,g),a(e,i,g),a(e,c,g),a(e,U,g),a(e,M,g),B(o,e,g),a(e,m,g),a(e,p,g),a(e,A,g),B(R,e,g),a(e,H,g),a(e,Q,g),a(e,v,g),B(X,e,g),a(e,D,g),a(e,V,g),a(e,Y,g),a(e,T,g),a(e,nl,g),B(F,e,g),a(e,al,g),a(e,P,g),a(e,el,g),B(q,e,g),a(e,sl,g),a(e,K,g),a(e,tl,g),B(_,e,g),a(e,Ml,g),a(e,O,g),a(e,x,g),B(Ul,e,g),a(e,pl,g),a(e,ll,g),a(e,il,g),a(e,L,g),a(e,wl,g),B(z,e,g),a(e,Jl,g),a(e,ml,g),a(e,s,g),B(b,e,g),a(e,Vl,g),a(e,hl,g),a(e,kl,g),B(yl,e,g),a(e,fl,g),bl=!0},p:Bl,i(e){bl||(I(o.$$.fragment,e),I(R.$$.fragment,e),I(X.$$.fragment,e),I(F.$$.fragment,e),I(q.$$.fragment,e),I(_.$$.fragment,e),I(Ul.$$.fragment,e),I(z.$$.fragment,e),I(b.$$.fragment,e),I(yl.$$.fragment,e),bl=!0)},o(e){d(o.$$.fragment,e),d(R.$$.fragment,e),d(X.$$.fragment,e),d(F.$$.fragment,e),d(q.$$.fragment,e),d(_.$$.fragment,e),d(Ul.$$.fragment,e),d(z.$$.fragment,e),d(b.$$.fragment,e),d(yl.$$.fragment,e),bl=!1},d(e){e&&(n(r),n(i),n(c),n(U),n(M),n(m),n(p),n(A),n(H),n(Q),n(v),n(D),n(V),n(Y),n(T),n(nl),n(al),n(P),n(el),n(sl),n(K),n(tl),n(Ml),n(O),n(x),n(pl),n(ll),n(il),n(L),n(wl),n(Jl),n(ml),n(s),n(Vl),n(hl),n(kl),n(fl)),W(o,e),W(R,e),W(X,e),W(F,e),W(q,e),W(_,e),W(Ul,e),W(z,e),W(b,e),W(yl,e)}}}function Ua(Z){let r,i,j="Pertama, jalankan TGI dengan parameter lanjutan:",c,U,J,M,o="Gunakan <code>InferenceClient</code> untuk generasi teks yang fleksibel:",m,p,G,A,R="Atau gunakan klien OpenAI:",H,Q,ul,v,X="Untuk <code>llama.cpp</code>, Anda dapat menetapkan parameter lanjutan saat menjalankan server:",D,V,rl,Y,T="Gunakan <code>InferenceClient</code>:",$,nl,F,al,P="Atau gunakan klien OpenAI untuk mengontrol parameter sampling:",gl,el,q,sl,K="Anda juga dapat menggunakan modul native <code>llama.cpp</code> untuk kontrol yang lebih mendetail:",Il,tl,_,Ml,O="Untuk penggunaan lanjutan dengan <code>vLLM</code>, Anda dapat menggunakan <code>InferenceClient</code>:",jl,x,Ul,pl,ll="Anda juga dapat menggunakan klien OpenAI:",dl,il,L,cl,wl="<code>vLLM</code> juga menyediakan antarmuka Python native dengan kontrol yang lebih rinci:",z,Jl,ml,ol;return U=new N({props:{code:"ZG9ja2VyJTIwcnVuJTIwLS1ncHVzJTIwYWxsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1zaG0tc2l6ZSUyMDFnJTIwJTVDJTBBJTIwJTIwJTIwJTIwLXAlMjA4MDgwJTNBODAlMjAlNUMlMEElMjAlMjAlMjAlMjAtdiUyMH4lMkYuY2FjaGUlMkZodWdnaW5nZmFjZSUzQSUyRmRhdGElMjAlNUMlMEElMjAlMjAlMjAlMjBnaGNyLmlvJTJGaHVnZ2luZ2ZhY2UlMkZ0ZXh0LWdlbmVyYXRpb24taW5mZXJlbmNlJTNBbGF0ZXN0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbC1pZCUyMEh1Z2dpbmdGYWNlVEIlMkZTbW9sTE0yLTM2ME0tSW5zdHJ1Y3QlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1heC10b3RhbC10b2tlbnMlMjA0MDk2JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tYXgtaW5wdXQtbGVuZ3RoJTIwMzA3MiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWF4LWJhdGNoLXRvdGFsLXRva2VucyUyMDgxOTIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXdhaXRpbmctc2VydmVkLXJhdGlvJTIwMS4y",highlighted:`docker run --gpus all \\
    --shm-size 1g \\
    -p 8080:80 \\
    -v ~/.cache/huggingface:/data \\
    ghcr.io/huggingface/text-generation-inference:latest \\
    --model-id HuggingFaceTB/SmolLM2-360M-Instruct \\
    --max-total-tokens 4096 \\
    --max-input-length 3072 \\
    --max-batch-total-tokens 8192 \\
    --waiting-served-ratio 1.2`,wrap:!1}}),p=new N({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEluZmVyZW5jZUNsaWVudCUwQSUwQWNsaWVudCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudChtb2RlbCUzRCUyMmh0dHAlM0ElMkYlMkZsb2NhbGhvc3QlM0E4MDgwJTIyKSUwQSUwQSUyMyUyMENvbnRvaCUyMHBhcmFtZXRlciUyMGxhbmp1dGFuJTBBcmVzcG9uc2UlMjAlM0QlMjBjbGllbnQuY2hhdF9jb21wbGV0aW9uKCUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNEJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnN5c3RlbSUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJLYW11JTIwYWRhbGFoJTIwc2VvcmFuZyUyMHBlbmRvbmdlbmclMjBrcmVhdGlmLiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMlR1bGlzJTIwc2VidWFoJTIwY2VyaXRhJTIwa3JlYXRpZiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC44JTJDJTBBJTIwJTIwJTIwJTIwbWF4X3Rva2VucyUzRDIwMCUyQyUwQSUyMCUyMCUyMCUyMHRvcF9wJTNEMC45NSUyQyUwQSklMEFwcmludChyZXNwb25zZS5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlLmNvbnRlbnQpJTBBJTBBJTIzJTIwR2VuZXJhc2klMjB0ZWtzJTIwbWVudGFoJTBBcmVzcG9uc2UlMjAlM0QlMjBjbGllbnQudGV4dF9nZW5lcmF0aW9uKCUwQSUyMCUyMCUyMCUyMCUyMlR1bGlzJTIwY2VyaXRhJTIwa3JlYXRpZiUyMHRlbnRhbmclMjBla3NwbG9yYXNpJTIwbHVhciUyMGFuZ2thc2ElMjIlMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDIwMCUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC44JTJDJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjk1JTJDJTBBJTIwJTIwJTIwJTIwcmVwZXRpdGlvbl9wZW5hbHR5JTNEMS4xJTJDJTBBJTIwJTIwJTIwJTIwZG9fc2FtcGxlJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGRldGFpbHMlM0RUcnVlJTJDJTBBKSUwQXByaW50KHJlc3BvbnNlLmdlbmVyYXRlZF90ZXh0KQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient

client = InferenceClient(model=<span class="hljs-string">&quot;http://localhost:8080&quot;</span>)

<span class="hljs-comment"># Contoh parameter lanjutan</span>
response = client.chat_completion(
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah seorang pendongeng kreatif.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>},
    ],
    temperature=<span class="hljs-number">0.8</span>,
    max_tokens=<span class="hljs-number">200</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)

<span class="hljs-comment"># Generasi teks mentah</span>
response = client.text_generation(
    <span class="hljs-string">&quot;Tulis cerita kreatif tentang eksplorasi luar angkasa&quot;</span>,
    max_new_tokens=<span class="hljs-number">200</span>,
    temperature=<span class="hljs-number">0.8</span>,
    top_p=<span class="hljs-number">0.95</span>,
    repetition_penalty=<span class="hljs-number">1.1</span>,
    do_sample=<span class="hljs-literal">True</span>,
    details=<span class="hljs-literal">True</span>,
)
<span class="hljs-built_in">print</span>(response.generated_text)`,wrap:!1}}),Q=new N({props:{code:"ZnJvbSUyMG9wZW5haSUyMGltcG9ydCUyME9wZW5BSSUwQSUwQWNsaWVudCUyMCUzRCUyME9wZW5BSShiYXNlX3VybCUzRCUyMmh0dHAlM0ElMkYlMkZsb2NhbGhvc3QlM0E4MDgwJTJGdjElMjIlMkMlMjBhcGlfa2V5JTNEJTIybm90LW5lZWRlZCUyMiklMEElMEElMjMlMjBDb250b2glMjBwYXJhbWV0ZXIlMjBsYW5qdXRhbiUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LmNoYXQuY29tcGxldGlvbnMuY3JlYXRlKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEJTIySHVnZ2luZ0ZhY2VUQiUyRlNtb2xMTTItMzYwTS1JbnN0cnVjdCUyMiUyQyUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNEJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnN5c3RlbSUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJLYW11JTIwYWRhbGFoJTIwc2VvcmFuZyUyMHBlbmRvbmdlbmclMjBrcmVhdGlmLiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMlR1bGlzJTIwc2VidWFoJTIwY2VyaXRhJTIwa3JlYXRpZiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC44JTJDJTIwJTIwJTIzJTIwTGViaWglMjB0aW5nZ2klMjB1bnR1ayUyMGhhc2lsJTIweWFuZyUyMGxlYmloJTIwa3JlYXRpZiUwQSklMEFwcmludChyZXNwb25zZS5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlLmNvbnRlbnQp",highlighted:`<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI

client = OpenAI(base_url=<span class="hljs-string">&quot;http://localhost:8080/v1&quot;</span>, api_key=<span class="hljs-string">&quot;not-needed&quot;</span>)

<span class="hljs-comment"># Contoh parameter lanjutan</span>
response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;HuggingFaceTB/SmolLM2-360M-Instruct&quot;</span>,
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah seorang pendongeng kreatif.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>},
    ],
    temperature=<span class="hljs-number">0.8</span>,  <span class="hljs-comment"># Lebih tinggi untuk hasil yang lebih kreatif</span>
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),V=new N({props:{code:"LiUyRnNlcnZlciUyMCU1QyUwQSUyMCUyMCUyMCUyMC1tJTIwc21vbGxtMi0xLjdiLWluc3RydWN0LlE0X0tfTS5nZ3VmJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1ob3N0JTIwMC4wLjAuMCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcG9ydCUyMDgwODAlMjAlNUMlMEElMjAlMjAlMjAlMjAtYyUyMDQwOTYlMjAlNUMlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBVa3VyYW4lMjBrb250ZWtzJTBBJTIwJTIwJTIwJTIwLS10aHJlYWRzJTIwOCUyMCU1QyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMEp1bWxhaCUyMHRocmVhZCUyMENQVSUyMHlhbmclMjBkaWd1bmFrYW4lMEElMjAlMjAlMjAlMjAtLWJhdGNoLXNpemUlMjA1MTIlMjAlNUMlMjAlMjAlMjAlMjMlMjBVa3VyYW4lMjBiYXRjaCUyMGV2YWx1YXNpJTIwcHJvbXB0JTBBJTIwJTIwJTIwJTIwLS1uLWdwdS1sYXllcnMlMjAwJTIwJTIwJTIwJTIwJTIwJTIzJTIwTGFwaXNhbiUyMEdQVSUyMCgwJTIwJTNEJTIwaGFueWElMjBDUFUp",highlighted:`./server \\
    -m smollm2-1.7b-instruct.Q4_K_M.gguf \\
    --host 0.0.0.0 \\
    --port 8080 \\
    -c 4096 \\            <span class="hljs-comment"># Ukuran konteks</span>
    --threads 8 \\        <span class="hljs-comment"># Jumlah thread CPU yang digunakan</span>
    --batch-size 512 \\   <span class="hljs-comment"># Ukuran batch evaluasi prompt</span>
    --n-gpu-layers 0     <span class="hljs-comment"># Lapisan GPU (0 = hanya CPU)</span>`,wrap:!1}}),nl=new N({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEluZmVyZW5jZUNsaWVudCUwQSUwQWNsaWVudCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudChtb2RlbCUzRCUyMmh0dHAlM0ElMkYlMkZsb2NhbGhvc3QlM0E4MDgwJTJGdjElMjIlMkMlMjB0b2tlbiUzRCUyMnNrLW5vLWtleS1yZXF1aXJlZCUyMiklMEElMEElMjMlMjBDb250b2glMjBwYXJhbWV0ZXIlMjBsYW5qdXRhbiUwQXJl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MEElMjAlMjAlMjAlMjByZXBldGl0aW9uX3BlbmFsdHklM0QxLjElMkMlMEElMjAlMjAlMjAlMjBkZXRhaWxzJTNEVHJ1ZSUyQyUwQSklMEFwcmludChyZXNwb25zZS5nZW5lcmF0ZWRfdGV4dCk=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient

client = InferenceClient(model=<span class="hljs-string">&quot;http://localhost:8080/v1&quot;</span>, token=<span class="hljs-string">&quot;sk-no-key-required&quot;</span>)

<span class="hljs-comment"># Contoh parameter lanjutan</span>
response = client.chat_completion(
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah seorang pendongeng kreatif.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>},
    ],
    temperature=<span class="hljs-number">0.8</span>,
    max_tokens=<span class="hljs-number">200</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)

<span class="hljs-comment"># Untuk generasi teks langsung</span>
response = client.text_generation(
    <span class="hljs-string">&quot;Tulis cerita kreatif tentang eksplorasi luar angkasa&quot;</span>,
    max_new_tokens=<span class="hljs-number">200</span>,
    temperature=<span class="hljs-number">0.8</span>,
    top_p=<span class="hljs-number">0.95</span>,
    repetition_penalty=<span class="hljs-number">1.1</span>,
    details=<span class="hljs-literal">True</span>,
)
<span class="hljs-built_in">print</span>(response.generated_text)`,wrap:!1}}),el=new N({props:{code:"ZnJvbSUyMG9wZW5haSUyMGltcG9ydCUyME9wZW5BSSUwQSUwQWNsaWVudCUyMCUzRCUyME9wZW5BSShiYXNlX3VybCUzRCUyMmh0dHAlM0ElMkYlMkZsb2Nhb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keyword">import</span> OpenAI

client = OpenAI(base_url=<span class="hljs-string">&quot;http://localhost:8080/v1&quot;</span>, api_key=<span class="hljs-string">&quot;sk-no-key-required&quot;</span>)

<span class="hljs-comment"># Contoh parameter lanjutan</span>
response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;smollm2-1.7b-instruct&quot;</span>,
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah seorang pendongeng kreatif.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>},
    ],
    temperature=<span class="hljs-number">0.8</span>,
    top_p=<span class="hljs-number">0.95</span>,
    frequency_penalty=<span class="hljs-number">0.5</span>,
    presence_penalty=<span class="hljs-number">0.5</span>,
    max_tokens=<span class="hljs-number">200</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),tl=new N({props:{code:"JTIzJTIwTWVuZ2d1bmFrYW4lMjBwYWtldCUyMGxsYW1hLWNwcC1weXRob24lMjB1bnR1ayUyMGFrc2VzJTIwbGFuZ3N1bmclMjBrZSUyMG1vZGVsJTBBZnJvbSUyMGxsYW1hX2NwcCUyMGltcG9ydCUyMExsYW1hJTBBJTBBJTIzJTIwTWVtdWF0JTIwbW9kZWwlMEFsbG0lMjAlM0QlMjBMbGFtYSglMEElMjAlMjAlMjAlMjBtb2RlbF9wYXRoJTNEJTIyc21vbGxtMi0xLjdiLWluc3RydWN0LlE0X0tfTS5nZ3VmJTIyJTJDJTBBJTIwJTIwJTIwJTIwbl9jdHglM0Q0MDk2JTJDJTBBJTIwJTIwJTIwJTIwbl90aHJlYWRzJTNEOCUyQyUwQSUyMCUyMCUyMCUyMG5fZ3B1X2xheWVycyUzRDAl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menggunakan paket llama-cpp-python untuk akses langsung ke model</span>
<span class="hljs-keyword">from</span> llama_cpp <span class="hljs-keyword">import</span> Llama

<span class="hljs-comment"># Memuat model</span>
llm = Llama(
    model_path=<span class="hljs-string">&quot;smollm2-1.7b-instruct.Q4_K_M.gguf&quot;</span>,
    n_ctx=<span class="hljs-number">4096</span>,
    n_threads=<span class="hljs-number">8</span>,
    n_gpu_layers=<span class="hljs-number">0</span>,
)

<span class="hljs-comment"># Format prompt sesuai format yang diharapkan oleh model</span>
prompt = <span class="hljs-string">&quot;&quot;&quot;&lt;|im_start|&gt;system
Kamu adalah seorang pendongeng kreatif.
&lt;|im_end|&gt;
&lt;|im_start|&gt;user
Tulis sebuah cerita kreatif
&lt;|im_end|&gt;
&lt;|im_start|&gt;assistant
&quot;&quot;&quot;</span>

<span class="hljs-comment"># Menghasilkan respon dengan kontrol parameter yang tepat</span>
output = llm(
    prompt,
    max_tokens=<span class="hljs-number">200</span>,
    temperature=<span class="hljs-number">0.8</span>,
    top_p=<span class="hljs-number">0.95</span>,
    frequency_penalty=<span class="hljs-number">0.5</span>,
    presence_penalty=<span class="hljs-number">0.5</span>,
    stop=[<span class="hljs-string">&quot;&lt;|im_end|&gt;&quot;</span>],
)

<span class="hljs-built_in">print</span>(output[<span class="hljs-string">&quot;choices&quot;</span>][<span class="hljs-number">0</span>][<span class="hljs-string">&quot;text&quot;</span>])`,wrap:!1}}),x=new N({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEluZmVyZW5jZUNsaWVudCUwQSUwQWNsaWVudCUyMCUzRCUyMEluZmVyZW5jZUNsaWVudChtb2RlbCUzRCUyMmh0dHAlM0ElMkYlMkZsb2NhbGhvc3QlM0E4MDAwJTJGdjElMjIpJTBBJTBBJTIzJTIwQ29udG9oJTIwcGFyYW1ldGVyJTIwbGFuanV0YW4lMEFyZXNwb25zZSUyMCUzRCUyMGNsaWVudC5jaGF0X2NvbXBsZXRpb24oJTBB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QocmVzcG9uc2UuZ2VuZXJhdGVkX3RleHQp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> InferenceClient

client = InferenceClient(model=<span class="hljs-string">&quot;http://localhost:8000/v1&quot;</span>)

<span class="hljs-comment"># Contoh parameter lanjutan</span>
response = client.chat_completion(
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah seorang pendongeng kreatif.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>},
    ],
    temperature=<span class="hljs-number">0.8</span>,
    max_tokens=<span class="hljs-number">200</span>,
    top_p=<span class="hljs-number">0.95</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)

<span class="hljs-comment"># Untuk generasi teks langsung</span>
response = client.text_generation(
    <span class="hljs-string">&quot;Tulis cerita kreatif tentang eksplorasi luar angkasa&quot;</span>,
    max_new_tokens=<span class="hljs-number">200</span>,
    temperature=<span class="hljs-number">0.8</span>,
    top_p=<span class="hljs-number">0.95</span>,
    details=<span class="hljs-literal">True</span>,
)
<span class="hljs-built_in">print</span>(response.generated_text)`,wrap:!1}}),il=new N({props:{code:"ZnJvbSUyMG9wZW5haSUyMGltcG9ydCUyME9wZW5BSSUwQSUwQWNsaWVudCUyMCUzRCUyME9wZW5BSShiYXNlX3VybCUzRCUyMmh0dHAlM0ElMkYlMkZsb2NhbGhvc3QlM0E4MDAwJTJGdjElMjIlMkMlMjBhcGlfa2V5JTNEJTIybm90LW5lZWRlZCUyMiklMEElMEElMjMlMjBDb250b2glMjBwYXJhbWV0ZXIlMjBsYW5qdXRhbiUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LmNoYXQuY29tcGxldGlvbnMuY3JlYXRlKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEJTIySHVnZ2luZ0ZhY2VUQiUyRlNtb2xMTTItMzYwTS1JbnN0cnVjdCUyMiUyQyUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTNEJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIycm9sZSUyMiUzQSUyMCUyMnN5c3RlbSUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJLYW11JTIwYWRhbGFoJTIwc2VvcmFuZyUyMHBlbmRvbmdlbmclMjBrcmVhdGlmLiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMlR1bGlzJTIwc2VidWFoJTIwY2VyaXRhJTIwa3JlYXRpZiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC44JTJDJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjk1JTJDJTBBJTIwJTIwJTIwJTIwbWF4X3Rva2VucyUzRDIwMCUyQyUwQSklMEFwcmludChyZXNwb25zZS5jaG9pY2VzJTVCMCU1RC5tZXNzYWdlLmNvbnRlbnQp",highlighted:`<span class="hljs-keyword">from</span> openai <span class="hljs-keyword">import</span> OpenAI

client = OpenAI(base_url=<span class="hljs-string">&quot;http://localhost:8000/v1&quot;</span>, api_key=<span class="hljs-string">&quot;not-needed&quot;</span>)

<span class="hljs-comment"># Contoh parameter lanjutan</span>
response = client.chat.completions.create(
    model=<span class="hljs-string">&quot;HuggingFaceTB/SmolLM2-360M-Instruct&quot;</span>,
    messages=[
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah seorang pendongeng kreatif.&quot;</span>},
        {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>},
    ],
    temperature=<span class="hljs-number">0.8</span>,
    top_p=<span class="hljs-number">0.95</span>,
    max_tokens=<span class="hljs-number">200</span>,
)
<span class="hljs-built_in">print</span>(response.choices[<span class="hljs-number">0</span>].message.content)`,wrap:!1}}),Jl=new N({props:{code:"ZnJvbSUyMHZsbG0lMjBpbXBvcnQlMjBMTE0lMkMlMjBTYW1wbGluZ1BhcmFtcyUwQSUwQSUyMyUyMEluaXNpYWxpc2FzaSUyMG1vZGVsJTIwZGVuZ2FuJTIwcGFyYW1ldGVyJTIwbGFuanV0YW4lMEFsbG0lMjAlM0QlMjBMTE0oJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0QlMjJIdWdnaW5nRmFjZVRCJTJGU21vbExNMi0zNjBNLUluc3RydWN0JTIyJTJDJTBBJTIwJTIwJTIwJTIwZ3B1X21lbW9yeV91dGlsaXphdGlvbiUzRDAuODUlMkMlMEElMjAlMjAlMjAlMjBtYXhfbnVtX2JhdGNoZWRfdG9rZW5zJTNEODE5MiUyQyUwQSUyMCUyMCUyMCUyMG1heF9udW1fc2VxcyUzRDI1NiUyQyUwQSUyMCUyMCUyMCUyMGJsb2NrX3NpemUlM0QxNiUyQyUwQSklMEElMEElMjMlMjBLb25maWd1cmFzaSUyMHBhcmFtZXRlciUyMHNhbXBsaW5nJTBBc2FtcGxpbmdfcGFyYW1zJTIwJTNEJTIwU2FtcGxpbmdQYXJhbXMoJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QwLjglMkMlMjAlMjAlMjMlMjBTZW1ha2luJTIwdGluZ2dpJTJDJTIwc2VtYWtpbiUyMGtyZWF0aWYlMEElMjAlMjAlMjAlMjB0b3BfcCUzRDAuOTUlMkMlMjAl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lN0IlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlMjJUdWxpcyUyMHNlYnVhaCUyMGNlcml0YSUyMGtyZWF0aWYlMjIlN0QlMkMlMEElNUQlMEFmb3JtYXR0ZWRfcHJvbXB0JTIwJTNEJTIwbGxtLmdldF9jaGF0X3RlbXBsYXRlKCkoY2hhdF9wcm9tcHQpJTBBb3V0cHV0cyUyMCUzRCUyMGxsbS5nZW5lcmF0ZShmb3JtYXR0ZWRfcHJvbXB0JTJDJTIwc2FtcGxpbmdfcGFyYW1zKSUwQXByaW50KG91dHB1dHMlNUIwJTVELm91dHB1dHMlNUIwJTVELnRleHQp",highlighted:`<span class="hljs-keyword">from</span> vllm <span class="hljs-keyword">import</span> LLM, SamplingParams

<span class="hljs-comment"># Inisialisasi model dengan parameter lanjutan</span>
llm = LLM(
    model=<span class="hljs-string">&quot;HuggingFaceTB/SmolLM2-360M-Instruct&quot;</span>,
    gpu_memory_utilization=<span class="hljs-number">0.85</span>,
    max_num_batched_tokens=<span class="hljs-number">8192</span>,
    max_num_seqs=<span class="hljs-number">256</span>,
    block_size=<span class="hljs-number">16</span>,
)

<span class="hljs-comment"># Konfigurasi parameter sampling</span>
sampling_params = SamplingParams(
    temperature=<span class="hljs-number">0.8</span>,  <span class="hljs-comment"># Semakin tinggi, semakin kreatif</span>
    top_p=<span class="hljs-number">0.95</span>,  <span class="hljs-comment"># Pertimbangkan 95% dari massa probabilitas teratas</span>
    max_tokens=<span class="hljs-number">100</span>,  <span class="hljs-comment"># Panjang maksimum</span>
    presence_penalty=<span class="hljs-number">1.1</span>,  <span class="hljs-comment"># Kurangi pengulangan</span>
    frequency_penalty=<span class="hljs-number">1.1</span>,  <span class="hljs-comment"># Kurangi pengulangan</span>
    stop=[<span class="hljs-string">&quot;\\n\\n&quot;</span>, <span class="hljs-string">&quot;###&quot;</span>],  <span class="hljs-comment"># Urutan berhenti</span>
)

<span class="hljs-comment"># Menghasilkan teks</span>
prompt = <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>
outputs = llm.generate(prompt, sampling_params)
<span class="hljs-built_in">print</span>(outputs[<span class="hljs-number">0</span>].outputs[<span class="hljs-number">0</span>].text)

<span class="hljs-comment"># Untuk interaksi gaya chat</span>
chat_prompt = [
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;system&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Kamu adalah seorang pendongeng kreatif.&quot;</span>},
    {<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>},
]
formatted_prompt = llm.get_chat_template()(chat_prompt)
outputs = llm.generate(formatted_prompt, sampling_params)
<span class="hljs-built_in">print</span>(outputs[<span class="hljs-number">0</span>].outputs[<span class="hljs-number">0</span>].text)`,wrap:!1}}),{c(){r=S(`<hfoption value="tgi" label="TGI">
`),i=w("p"),i.textContent=j,c=y(),k(U.$$.fragment),J=y(),M=w("p"),M.innerHTML=o,m=y(),k(p.$$.fragment),G=y(),A=w("p"),A.textContent=R,H=y(),k(Q.$$.fragment),ul=S(`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">
`),v=w("p"),v.innerHTML=X,D=y(),k(V.$$.fragment),rl=y(),Y=w("p"),Y.innerHTML=T,$=y(),k(nl.$$.fragment),F=y(),al=w("p"),al.textContent=P,gl=y(),k(el.$$.fragment),q=y(),sl=w("p"),sl.innerHTML=K,Il=y(),k(tl.$$.fragment),_=S(`
</hfoption>
<hfoption value="vllm" label="vLLM">
`),Ml=w("p"),Ml.innerHTML=O,jl=y(),k(x.$$.fragment),Ul=y(),pl=w("p"),pl.textContent=ll,dl=y(),k(il.$$.fragment),L=y(),cl=w("p"),cl.innerHTML=wl,z=y(),k(Jl.$$.fragment),ml=S(`
</hfoption>`)},l(s){r=E(s,`<hfoption value="tgi" label="TGI">
`),i=h(s,"P",{"data-svelte-h":!0}),C(i)!=="svelte-1js88tn"&&(i.textContent=j),c=u(s),f(U.$$.fragment,s),J=u(s),M=h(s,"P",{"data-svelte-h":!0}),C(M)!=="svelte-133q38m"&&(M.innerHTML=o),m=u(s),f(p.$$.fragment,s),G=u(s),A=h(s,"P",{"data-svelte-h":!0}),C(A)!=="svelte-1t7u5oh"&&(A.textContent=R),H=u(s),f(Q.$$.fragment,s),ul=E(s,`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">
`),v=h(s,"P",{"data-svelte-h":!0}),C(v)!=="svelte-13oenko"&&(v.innerHTML=X),D=u(s),f(V.$$.fragment,s),rl=u(s),Y=h(s,"P",{"data-svelte-h":!0}),C(Y)!=="svelte-1nk0za2"&&(Y.innerHTML=T),$=u(s),f(nl.$$.fragment,s),F=u(s),al=h(s,"P",{"data-svelte-h":!0}),C(al)!=="svelte-seg517"&&(al.textContent=P),gl=u(s),f(el.$$.fragment,s),q=u(s),sl=h(s,"P",{"data-svelte-h":!0}),C(sl)!=="svelte-1qwmquu"&&(sl.innerHTML=K),Il=u(s),f(tl.$$.fragment,s),_=E(s,`
</hfoption>
<hfoption value="vllm" label="vLLM">
`),Ml=h(s,"P",{"data-svelte-h":!0}),C(Ml)!=="svelte-1lq8je2"&&(Ml.innerHTML=O),jl=u(s),f(x.$$.fragment,s),Ul=u(s),pl=h(s,"P",{"data-svelte-h":!0}),C(pl)!=="svelte-xn2mvu"&&(pl.textContent=ll),dl=u(s),f(il.$$.fragment,s),L=u(s),cl=h(s,"P",{"data-svelte-h":!0}),C(cl)!=="svelte-1k3elb6"&&(cl.innerHTML=wl),z=u(s),f(Jl.$$.fragment,s),ml=E(s,`
</hfoption>`)},m(s,b){a(s,r,b),a(s,i,b),a(s,c,b),B(U,s,b),a(s,J,b),a(s,M,b),a(s,m,b),B(p,s,b),a(s,G,b),a(s,A,b),a(s,H,b),B(Q,s,b),a(s,ul,b),a(s,v,b),a(s,D,b),B(V,s,b),a(s,rl,b),a(s,Y,b),a(s,$,b),B(nl,s,b),a(s,F,b),a(s,al,b),a(s,gl,b),B(el,s,b),a(s,q,b),a(s,sl,b),a(s,Il,b),B(tl,s,b),a(s,_,b),a(s,Ml,b),a(s,jl,b),B(x,s,b),a(s,Ul,b),a(s,pl,b),a(s,dl,b),B(il,s,b),a(s,L,b),a(s,cl,b),a(s,z,b),B(Jl,s,b),a(s,ml,b),ol=!0},p:Bl,i(s){ol||(I(U.$$.fragment,s),I(p.$$.fragment,s),I(Q.$$.fragment,s),I(V.$$.fragment,s),I(nl.$$.fragment,s),I(el.$$.fragment,s),I(tl.$$.fragment,s),I(x.$$.fragment,s),I(il.$$.fragment,s),I(Jl.$$.fragment,s),ol=!0)},o(s){d(U.$$.fragment,s),d(p.$$.fragment,s),d(Q.$$.fragment,s),d(V.$$.fragment,s),d(nl.$$.fragment,s),d(el.$$.fragment,s),d(tl.$$.fragment,s),d(x.$$.fragment,s),d(il.$$.fragment,s),d(Jl.$$.fragment,s),ol=!1},d(s){s&&(n(r),n(i),n(c),n(J),n(M),n(m),n(G),n(A),n(H),n(ul),n(v),n(D),n(rl),n(Y),n($),n(F),n(al),n(gl),n(q),n(sl),n(Il),n(_),n(Ml),n(jl),n(Ul),n(pl),n(dl),n(L),n(cl),n(z),n(ml)),W(U,s),W(p,s),W(Q,s),W(V,s),W(nl,s),W(el,s),W(tl,s),W(x,s),W(il,s),W(Jl,s)}}}function Ja(Z){let r,i,j,c,U,J,M,o;return i=new N({props:{code:"Y2xpZW50LmdlbmVyYXRlKCUwQSUyMCUyMCUyMCUyMCUyMlR1bGlzJTIwc2VidWFoJTIwY2VyaXRhJTIwa3JlYXRpZiUyMiUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC44JTJDJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjk1JTJDJTBBJTIwJTIwJTIwJTIwdG9wX2slM0Q1MCUyQyUwQSUyMCUyMCUyMCUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTBBJTIwJTIwJTIwJTIwcmVwZXRpdGlvbl9wZW5hbHR5JTNEMS4xJTJDJTBBKQ==",highlighted:`client.generate(
    <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>,
    temperature=<span class="hljs-number">0.8</span>,
    top_p=<span class="hljs-number">0.95</span>,
    top_k=<span class="hljs-number">50</span>,
    max_new_tokens=<span class="hljs-number">100</span>,
    repetition_penalty=<span class="hljs-number">1.1</span>,
)`,wrap:!1}}),c=new N({props:{code:"JTIzJTIwTWVsYWx1aSUyMEFQSSUyME9wZW5BSSUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LmNvbXBsZXRpb25zLmNyZWF0ZSglMEElMjAlMjAlMjAlMjBtb2RlbCUzRCUyMnNtb2xsbTItMS43Yi1pbnN0cnVjdCUyMiUyQyUyMCUyMCUyMyUyME5hbWElMjBtb2RlbCUyMChiaXNhJTIwYmVydXBhJTIwc3RyaW5nJTIwYXBhJTIwc2FqYSUyMHVudHVrJTIwc2VydmVyJTIwbGxhbWEuY3BwKSUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMlR1bGlzJTIwc2VidWFoJTIwY2VyaXRhJTIwa3JlYXRpZiUyMiUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC44JTJDJTIwJTIwJTIzJTIwU2VtYWtpbiUyMHRpbmdnaSUyQyUyMHNlbWFraW4lMjBrcmVhdGlmJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjk1JTJDJTIwJTIwJTIzJTIwUGVydGltYmFuZ2thbiUyMDk1JTI1JTIwZGFyaSUyMG1hc3NhJTIwcHJvYmFiaWxpdGFzJTIwdGVyYXRhcyUwQSUyMCUyMCUyMCUyMGZyZXF1ZW5jeV9wZW5hbHR5JTNEMS4xJTJDJTIwJTIwJTIzJTIwS3VyYW5naSUyMHBlbmd1bGFuZ2FuJTBBJTIwJTIwJTIwJTIwcHJlc2VuY2VfcGVuYWx0eSUzRDAuMSUyQyUyMCUyMCUyMyUyMEt1cmFuZ2klMjBwZW5ndWxhbmdhbiUwQSUyMCUyMCUyMCUyMG1heF90b2tlbnMlM0QxMDAlMkMlMjAlMjAlMjMlMjBQYW5qYW5nJTIwbWFrc2ltdW0lMEEpJTBBJTBBJTIzJTIwTWVsYWx1aSUyMGFrc2VzJTIwbGFuZ3N1bmclMjBsbGFtYS1jcHAtcHl0aG9uJTBBb3V0cHV0JTIwJTNEJTIwbGxtKCUwQSUyMCUyMCUyMCUyMCUyMlR1bGlzJTIwc2VidWFoJTIwY2VyaXRhJTIwa3JlYXRpZiUyMiUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC44JTJDJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjk1JTJDJTBBJTIwJTIwJTIwJTIwdG9wX2slM0Q1MCUyQyUwQSUyMCUyMCUyMCUyMG1heF90b2tlbnMlM0QxMDAlMkMlMEElMjAlMjAlMjAlMjByZXBlYXRfcGVuYWx0eSUzRDEuMSUyQyUwQSk=",highlighted:`<span class="hljs-comment"># Melalui API OpenAI</span>
response = client.completions.create(
    model=<span class="hljs-string">&quot;smollm2-1.7b-instruct&quot;</span>,  <span class="hljs-comment"># Nama model (bisa berupa string apa saja untuk server llama.cpp)</span>
    prompt=<span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>,
    temperature=<span class="hljs-number">0.8</span>,  <span class="hljs-comment"># Semakin tinggi, semakin kreatif</span>
    top_p=<span class="hljs-number">0.95</span>,  <span class="hljs-comment"># Pertimbangkan 95% dari massa probabilitas teratas</span>
    frequency_penalty=<span class="hljs-number">1.1</span>,  <span class="hljs-comment"># Kurangi pengulangan</span>
    presence_penalty=<span class="hljs-number">0.1</span>,  <span class="hljs-comment"># Kurangi pengulangan</span>
    max_tokens=<span class="hljs-number">100</span>,  <span class="hljs-comment"># Panjang maksimum</span>
)

<span class="hljs-comment"># Melalui akses langsung llama-cpp-python</span>
output = llm(
    <span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>,
    temperature=<span class="hljs-number">0.8</span>,
    top_p=<span class="hljs-number">0.95</span>,
    top_k=<span class="hljs-number">50</span>,
    max_tokens=<span class="hljs-number">100</span>,
    repeat_penalty=<span class="hljs-number">1.1</span>,
)`,wrap:!1}}),J=new N({props:{code:"cGFyYW1zJTIwJTNEJTIwU2FtcGxpbmdQYXJhbXMoJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QwLjglMkMlMjAlMjAlMjMlMjBTZW1ha2luJTIwdGluZ2dpJTJDJTIwc2VtYWtpbiUyMGtyZWF0aWYlMEElMjAlMjAlMjAlMjB0b3BfcCUzRDAuOTUlMkMlMjAlMjAlMjMlMjBQZXJ0aW1iYW5na2FuJTIwOTUlMjUlMjBkYXJpJTIwbWFzc2ElMjBwcm9iYWJpbGl0YXMlMjB0ZXJhdGFzJTBBJTIwJTIwJTIwJTIwdG9wX2slM0Q1MCUyQyUyMCUyMCUyMyUyMFBlcnRpbWJhbmdrYW4lMjA1MCUyMHRva2VuJTIwdGVyYXRhcyUwQSUyMCUyMCUyMCUyMG1heF90b2tlbnMlM0QxMDAlMkMlMjAlMjAlMjMlMjBQYW5qYW5nJTIwbWFrc2ltdW0lMEElMjAlMjAlMjAlMjBwcmVzZW5jZV9wZW5hbHR5JTNEMC4xJTJDJTIwJTIwJTIzJTIwS3VyYW5naSUyMHBlbmd1bGFuZ2FuJTBBKSUwQWxsbS5nZW5lcmF0ZSglMjJUdWxpcyUyMHNlYnVhaCUyMGNlcml0YSUyMGtyZWF0aWYlMjIlMkMlMjBzYW1wbGluZ19wYXJhbXMlM0RwYXJhbXMp",highlighted:`params = SamplingParams(
    temperature=<span class="hljs-number">0.8</span>,  <span class="hljs-comment"># Semakin tinggi, semakin kreatif</span>
    top_p=<span class="hljs-number">0.95</span>,  <span class="hljs-comment"># Pertimbangkan 95% dari massa probabilitas teratas</span>
    top_k=<span class="hljs-number">50</span>,  <span class="hljs-comment"># Pertimbangkan 50 token teratas</span>
    max_tokens=<span class="hljs-number">100</span>,  <span class="hljs-comment"># Panjang maksimum</span>
    presence_penalty=<span class="hljs-number">0.1</span>,  <span class="hljs-comment"># Kurangi pengulangan</span>
)
llm.generate(<span class="hljs-string">&quot;Tulis sebuah cerita kreatif&quot;</span>, sampling_params=params)`,wrap:!1}}),{c(){r=S(`<hfoption value="tgi" label="TGI">

	`),k(i.$$.fragment),j=S(`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">

	`),k(c.$$.fragment),U=S(`
</hfoption>
<hfoption value="vllm" label="vLLM">

	`),k(J.$$.fragment),M=S(`
</hfoption>`)},l(m){r=E(m,`<hfoption value="tgi" label="TGI">

	`),f(i.$$.fragment,m),j=E(m,`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">

	`),f(c.$$.fragment,m),U=E(m,`
</hfoption>
<hfoption value="vllm" label="vLLM">

	`),f(J.$$.fragment,m),M=E(m,`
</hfoption>`)},m(m,p){a(m,r,p),B(i,m,p),a(m,j,p),B(c,m,p),a(m,U,p),B(J,m,p),a(m,M,p),o=!0},p:Bl,i(m){o||(I(i.$$.fragment,m),I(c.$$.fragment,m),I(J.$$.fragment,m),o=!0)},o(m){d(i.$$.fragment,m),d(c.$$.fragment,m),d(J.$$.fragment,m),o=!1},d(m){m&&(n(r),n(j),n(U),n(M)),W(i,m),W(c,m),W(J,m)}}}function oa(Z){let r,i,j,c,U,J;return i=new N({props:{code:"JTIzJTIwTWVsYWx1aSUyMEFQSSUyME9wZW5BSSUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LmNvbXBsZXRpb25zLmNyZWF0ZSglMEElMjAlMjAlMjAlMjBtb2RlbCUzRCUyMnNtb2xsbTItMS43Yi1pbnN0cnVjdCUyMiUyQyUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMlR1bGlzJTIwdGVrcyUyMHlhbmclMjBiZXJ2YXJpYXNpJTIyJTJDJTBBJTIwJTIwJTIwJTIwZnJlcXVlbmN5X3BlbmFsdHklM0QxLjElMkMlMjAlMjAlMjMlMjBQZW5hbHRpJTIwdW50dWslMjB0b2tlbiUyMHlhbmclMjBzZXJpbmclMjBtdW5jdWwlMEElMjAlMjAlMjAlMjBwcmVzZW5jZV9wZW5hbHR5JTNEMC44JTJDJTIwJTIwJTIzJTIwUGVuYWx0aSUyMHVudHVrJTIwdG9rZW4lMjB5YW5nJTIwc3VkYWglMjBtdW5jdWwlMEEpJTBBJTBBJTIzJTIwTWVsYWx1aSUyMG1vZHVsJTIwbGFuZ3N1bmclMEFvdXRwdXQlMjAlM0QlMjBsbG0oJTBBJTIwJTIwJTIwJTIwJTIyVHVsaXMlMjB0ZWtzJTIweWFuZyUyMGJlcnZhcmlhc2klMjIlMkMlMEElMjAlMjAlMjAlMjByZXBlYXRfcGVuYWx0eSUzRDEuMSUyQyUyMCUyMCUyMyUyMFBlbmFsdGklMjB1bnR1ayUyMHRva2VuJTIweWFuZyUyMGRpdWxhbmclMEElMjAlMjAlMjAlMjBmcmVxdWVuY3lfcGVuYWx0eSUzRDAuNSUyQyUyMCUyMCUyMyUyMFBlbmFsdGklMjB0YW1iYWhhbiUyMHVudHVrJTIwZnJla3VlbnNpJTIwdGluZ2dpJTBBJTIwJTIwJTIwJTIwcHJlc2VuY2VfcGVuYWx0eSUzRDAuNSUyQyUyMCUyMCUyMyUyMFBlbmFsdGklMjB0YW1iYWhhbiUyMHVudHVrJTIwdG9rZW4lMjB5YW5nJTIwc3VkYWglMjBtdW5jdWwlMEEp",highlighted:`<span class="hljs-comment"># Melalui API OpenAI</span>
response = client.completions.create(
    model=<span class="hljs-string">&quot;smollm2-1.7b-instruct&quot;</span>,
    prompt=<span class="hljs-string">&quot;Tulis teks yang bervariasi&quot;</span>,
    frequency_penalty=<span class="hljs-number">1.1</span>,  <span class="hljs-comment"># Penalti untuk token yang sering muncul</span>
    presence_penalty=<span class="hljs-number">0.8</span>,  <span class="hljs-comment"># Penalti untuk token yang sudah muncul</span>
)

<span class="hljs-comment"># Melalui modul langsung</span>
output = llm(
    <span class="hljs-string">&quot;Tulis teks yang bervariasi&quot;</span>,
    repeat_penalty=<span class="hljs-number">1.1</span>,  <span class="hljs-comment"># Penalti untuk token yang diulang</span>
    frequency_penalty=<span class="hljs-number">0.5</span>,  <span class="hljs-comment"># Penalti tambahan untuk frekuensi tinggi</span>
    presence_penalty=<span class="hljs-number">0.5</span>,  <span class="hljs-comment"># Penalti tambahan untuk token yang sudah muncul</span>
)`,wrap:!1}}),c=new N({props:{code:"cGFyYW1zJTIwJTNEJTIwU2FtcGxpbmdQYXJhbXMoJTBBJTIwJTIwJTIwJTIwcHJlc2VuY2VfcGVuYWx0eSUzRDAuMSUyQyUyMCUyMCUyMyUyMFBlbmFsdGklMjB1bnR1ayUyMGtlYmVyYWRhYW4lMjB0b2tlbiUwQSUyMCUyMCUyMCUyMGZyZXF1ZW5jeV9wZW5hbHR5JTNEMC4xJTJDJTIwJTIwJTIzJTIwUGVuYWx0aSUyMHVudHVrJTIwZnJla3VlbnNpJTIwdG9rZW4lMEEp",highlighted:`params = SamplingParams(
    presence_penalty=<span class="hljs-number">0.1</span>,  <span class="hljs-comment"># Penalti untuk keberadaan token</span>
    frequency_penalty=<span class="hljs-number">0.1</span>,  <span class="hljs-comment"># Penalti untuk frekuensi token</span>
)`,wrap:!1}}),{c(){r=S(`<hfoption value="tgi" label="TGI">
\`\`\`python
client.generate(
    "Tulis teks yang bervariasi",
    repetition_penalty=1.1,  # Penalti untuk token yang diulang
    no_repeat_ngram_size=3,  # Cegah pengulangan 3-gram
)
\`\`\`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">

	`),k(i.$$.fragment),j=S(`
</hfoption>
<hfoption value="vllm" label="vLLM">

	`),k(c.$$.fragment),U=S(`
</hfoption>`)},l(M){r=E(M,`<hfoption value="tgi" label="TGI">
\`\`\`python
client.generate(
    "Tulis teks yang bervariasi",
    repetition_penalty=1.1,  # Penalti untuk token yang diulang
    no_repeat_ngram_size=3,  # Cegah pengulangan 3-gram
)
\`\`\`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">

	`),f(i.$$.fragment,M),j=E(M,`
</hfoption>
<hfoption value="vllm" label="vLLM">

	`),f(c.$$.fragment,M),U=E(M,`
</hfoption>`)},m(M,o){a(M,r,o),B(i,M,o),a(M,j,o),B(c,M,o),a(M,U,o),J=!0},p:Bl,i(M){J||(I(i.$$.fragment,M),I(c.$$.fragment,M),J=!0)},o(M){d(i.$$.fragment,M),d(c.$$.fragment,M),J=!1},d(M){M&&(n(r),n(j),n(U)),W(i,M),W(c,M)}}}function ca(Z){let r,i,j,c,U,J;return i=new N({props:{code:"JTIzJTIwTWVsYWx1aSUyMEFQSSUyME9wZW5BSSUwQXJlc3BvbnNlJTIwJTNEJTIwY2xpZW50LmNvbXBsZXRpb25zLmNyZWF0ZSglMEElMjAlMjAlMjAlMjBtb2RlbCUzRCUyMnNtb2xsbTItMS43Yi1pbnN0cnVjdCUyMiUyQyUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMkhhc2lsa2FuJTIwcGFyYWdyYWYlMjBzaW5na2F0JTIyJTJDJTBBJTIwJTIwJTIwJTIwbWF4X3Rva2VucyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMHN0b3AlM0QlNUIlMjIlNUNuJTVDbiUyMiUyQyUyMCUyMiUyMyUyMyUyMyUyMiU1RCUyQyUwQSklMEElMEElMjMlMjBNZWxhbHVpJTIwbW9kdWwlMjBsYW5nc3VuZyUwQW91dHB1dCUyMCUzRCUyMGxsbSglMjJIYXNpbGthbiUyMHBhcmFncmFmJTIwc2luZ2thdCUyMiUyQyUyMG1heF90b2tlbnMlM0QxMDAlMkMlMjBzdG9wJTNEJTVCJTIyJTVDbiU1Q24lMjIlMkMlMjAlMjIlMjMlMjMlMjMlMjIlNUQp",highlighted:`<span class="hljs-comment"># Melalui API OpenAI</span>
response = client.completions.create(
    model=<span class="hljs-string">&quot;smollm2-1.7b-instruct&quot;</span>,
    prompt=<span class="hljs-string">&quot;Hasilkan paragraf singkat&quot;</span>,
    max_tokens=<span class="hljs-number">100</span>,
    stop=[<span class="hljs-string">&quot;\\n\\n&quot;</span>, <span class="hljs-string">&quot;###&quot;</span>],
)

<span class="hljs-comment"># Melalui modul langsung</span>
output = llm(<span class="hljs-string">&quot;Hasilkan paragraf singkat&quot;</span>, max_tokens=<span class="hljs-number">100</span>, stop=[<span class="hljs-string">&quot;\\n\\n&quot;</span>, <span class="hljs-string">&quot;###&quot;</span>])`,wrap:!1}}),c=new N({props:{code:"cGFyYW1zJTIwJTNEJTIwU2FtcGxpbmdQYXJhbXMoJTBBJTIwJTIwJTIwJTIwbWF4X3Rva2VucyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMG1pbl90b2tlbnMlM0QxMCUyQyUwQSUyMCUyMCUyMCUyMHN0b3AlM0QlNUIlMjIlMjMlMjMlMjMlMjIlMkMlMjAlMjIlNUNuJTVDbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGlnbm9yZV9lb3MlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlJTJDJTBBKQ==",highlighted:`params = SamplingParams(
    max_tokens=<span class="hljs-number">100</span>,
    min_tokens=<span class="hljs-number">10</span>,
    stop=[<span class="hljs-string">&quot;###&quot;</span>, <span class="hljs-string">&quot;\\n\\n&quot;</span>],
    ignore_eos=<span class="hljs-literal">False</span>,
    skip_special_tokens=<span class="hljs-literal">True</span>,
)`,wrap:!1}}),{c(){r=S(`<hfoption value="tgi" label="TGI">
\`\`\`python
client.generate(
    "Hasilkan paragraf singkat",
    max_new_tokens=100,
    min_new_tokens=10,
    stop_sequences=["\\n\\n", "###"],
)
\`\`\`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">

	`),k(i.$$.fragment),j=S(`
</hfoption>
<hfoption value="vllm" label="vLLM">

	`),k(c.$$.fragment),U=S(`
</hfoption>`)},l(M){r=E(M,`<hfoption value="tgi" label="TGI">
\`\`\`python
client.generate(
    "Hasilkan paragraf singkat",
    max_new_tokens=100,
    min_new_tokens=10,
    stop_sequences=["\\n\\n", "###"],
)
\`\`\`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">

	`),f(i.$$.fragment,M),j=E(M,`
</hfoption>
<hfoption value="vllm" label="vLLM">

	`),f(c.$$.fragment,M),U=E(M,`
</hfoption>`)},m(M,o){a(M,r,o),B(i,M,o),a(M,j,o),B(c,M,o),a(M,U,o),J=!0},p:Bl,i(M){J||(I(i.$$.fragment,M),I(c.$$.fragment,M),J=!0)},o(M){d(i.$$.fragment,M),d(c.$$.fragment,M),J=!1},d(M){M&&(n(r),n(j),n(U)),W(i,M),W(c,M)}}}function Ta(Z){let r,i,j="TGI menggunakan Flash Attention 2 dan continuous batching:",c,U,J,M,o="llama.cpp menggunakan kuantisasi dan tata letak memori yang dioptimalkan:",m,p,G,A,R="Untuk model terlalu besar bagi GPU Anda, gunakan offloading ke CPU:",H,Q,ul,v,X="vLLM menggunakan PagedAttention untuk manajemen memori optimal:",D,V,rl,Y;return U=new N({props:{code:"ZG9ja2VyJTIwcnVuJTIwLS1ncHVzJTIwYWxsJTIwLXAlMjA4MDgwJTNBODAlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXNobS1zaXplJTIwMWclMjAlNUMlMEElMjAlMjAlMjAlMjBnaGNyLmlvJTJGaHVnZ2luZ2ZhY2UlMkZ0ZXh0LWdlbmVyYXRpb24taW5mZXJlbmNlJTNBbGF0ZXN0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbC1pZCUyMEh1Z2dpbmdGYWNlVEIlMkZTbW9sTE0yLTEuN0ItSW5zdHJ1Y3QlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1heC1iYXRjaC10b3RhbC10b2tlbnMlMjA4MTkyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tYXgtaW5wdXQtbGVuZ3RoJTIwNDA5Ng==",highlighted:`docker run --gpus all -p 8080:80 \\
    --shm-size 1g \\
    ghcr.io/huggingface/text-generation-inference:latest \\
    --model-id HuggingFaceTB/SmolLM2-1.7B-Instruct \\
    --max-batch-total-tokens 8192 \\
    --max-input-length 4096`,wrap:!1}}),p=new N({props:{code:"LiUyRnNlcnZlciUyMCU1QyUwQSUyMCUyMCUyMCUyMC1tJTIwc21vbGxtMi0xLjdiLWluc3RydWN0LlE0X0tfTS5nZ3VmJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1ob3N0JTIwMC4wLjAuMCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcG9ydCUyMDgwODAlMjAlNUMlMEElMjAlMjAlMjAlMjAtYyUyMDIwNDglMjAlNUMlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBVa3VyYW4lMjBrb250ZWtzJTBBJTIwJTIwJTIwJTIwLS10aHJlYWRzJTIwNCUyMCU1QyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMFRocmVhZCUyMENQVSUwQSUyMCUyMCUyMCUyMC0tbi1ncHUtbGF5ZXJzJTIwMzIlMjAlNUMlMjAlMjAlMjAlMjAlMjAlMjMlMjBHdW5ha2FuJTIwbGViaWglMjBiYW55YWslMjBsYXBpc2FuJTIwR1BVJTIwdW50dWslMjBtb2RlbCUyMHlhbmclMjBsZWJpaCUyMGJlc2FyJTBBJTIwJTIwJTIwJTIwLS1tbG9jayUyMCU1QyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMEt1bmNpJTIwbWVtb3JpJTIwdW50dWslMjBtZW5jZWdhaCUyMHN3YXBwaW5nJTBBJTIwJTIwJTIwJTIwLS1jb250LWJhdGNoaW5nJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwQWt0aWZrYW4lMjBiYXRjaGluZyUyMGtvbnRpbnU=",highlighted:`./server \\
    -m smollm2-1.7b-instruct.Q4_K_M.gguf \\
    --host 0.0.0.0 \\
    --port 8080 \\
    -c 2048 \\               <span class="hljs-comment"># Ukuran konteks</span>
    --threads 4 \\           <span class="hljs-comment"># Thread CPU</span>
    --n-gpu-layers 32 \\     <span class="hljs-comment"># Gunakan lebih banyak lapisan GPU untuk model yang lebih besar</span>
    --mlock \\               <span class="hljs-comment"># Kunci memori untuk mencegah swapping</span>
    --cont-batching         <span class="hljs-comment"># Aktifkan batching kontinu</span>`,wrap:!1}}),Q=new N({props:{code:"LiUyRnNlcnZlciUyMCU1QyUwQSUyMCUyMCUyMCUyMC1tJTIwc21vbGxtMi0xLjdiLWluc3RydWN0LlE0X0tfTS5nZ3VmJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1uLWdwdS1sYXllcnMlMjAyMCUyMCU1QyUyMCUyMCUyMCUyMCUyMCUyMyUyMFNpbXBhbiUyMDIwJTIwbGFwaXNhbiUyMHBlcnRhbWElMjBkaSUyMEdQVSUwQSUyMCUyMCUyMCUyMC0tdGhyZWFkcyUyMDglMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBHdW5ha2FuJTIwbGViaWglMjBiYW55YWslMjB0aHJlYWQlMjBDUFUlMjB1bnR1ayUyMGxhcGlzYW4lMjBDUFU=",highlighted:`./server \\
    -m smollm2-1.7b-instruct.Q4_K_M.gguf \\
    --n-gpu-layers 20 \\     <span class="hljs-comment"># Simpan 20 lapisan pertama di GPU</span>
    --threads 8             <span class="hljs-comment"># Gunakan lebih banyak thread CPU untuk lapisan CPU</span>`,wrap:!1}}),V=new N({props:{code:"ZnJvbSUyMHZsbG0uZW5naW5lLmFyZ191dGlscyUyMGltcG9ydCUyMEFzeW5jRW5naW5lQXJncyUwQSUwQWVuZ2luZV9hcmdzJTIwJTNEJTIwQXN5bmNFbmdpbmVBcmdzKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEJTIySHVnZ2luZ0ZhY2VUQiUyRlNtb2xMTTItMS43Qi1JbnN0cnVjdCUyMiUyQyUwQSUyMCUyMCUyMCUyMGdwdV9tZW1vcnlfdXRpbGl6YXRpb24lM0QwLjg1JTJDJTBBJTIwJTIwJTIwJTIwbWF4X251bV9iYXRjaGVkX3Rva2VucyUzRDgxOTIlMkMlMEElMjAlMjAlMjAlMjBibG9ja19zaXplJTNEMTYlMkMlMEEpJTBBJTBBbGxtJTIwJTNEJTIwTExNKGVuZ2luZV9hcmdzJTNEZW5naW5lX2FyZ3Mp",highlighted:`<span class="hljs-keyword">from</span> vllm.engine.arg_utils <span class="hljs-keyword">import</span> AsyncEngineArgs

engine_args = AsyncEngineArgs(
    model=<span class="hljs-string">&quot;HuggingFaceTB/SmolLM2-1.7B-Instruct&quot;</span>,
    gpu_memory_utilization=<span class="hljs-number">0.85</span>,
    max_num_batched_tokens=<span class="hljs-number">8192</span>,
    block_size=<span class="hljs-number">16</span>,
)

llm = LLM(engine_args=engine_args)`,wrap:!1}}),{c(){r=S(`<hfoption value="tgi" label="TGI">
`),i=w("p"),i.textContent=j,c=y(),k(U.$$.fragment),J=S(`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">
`),M=w("p"),M.textContent=o,m=y(),k(p.$$.fragment),G=y(),A=w("p"),A.textContent=R,H=y(),k(Q.$$.fragment),ul=S(`
</hfoption>
<hfoption value="vllm" label="vLLM">
`),v=w("p"),v.textContent=X,D=y(),k(V.$$.fragment),rl=S(`
</hfoption>`)},l(T){r=E(T,`<hfoption value="tgi" label="TGI">
`),i=h(T,"P",{"data-svelte-h":!0}),C(i)!=="svelte-iqkcj8"&&(i.textContent=j),c=u(T),f(U.$$.fragment,T),J=E(T,`
</hfoption>
<hfoption value="llama.cpp" label="llama.cpp">
`),M=h(T,"P",{"data-svelte-h":!0}),C(M)!=="svelte-x52dpz"&&(M.textContent=o),m=u(T),f(p.$$.fragment,T),G=u(T),A=h(T,"P",{"data-svelte-h":!0}),C(A)!=="svelte-1lh932n"&&(A.textContent=R),H=u(T),f(Q.$$.fragment,T),ul=E(T,`
</hfoption>
<hfoption value="vllm" label="vLLM">
`),v=h(T,"P",{"data-svelte-h":!0}),C(v)!=="svelte-v17cca"&&(v.textContent=X),D=u(T),f(V.$$.fragment,T),rl=E(T,`
</hfoption>`)},m(T,$){a(T,r,$),a(T,i,$),a(T,c,$),B(U,T,$),a(T,J,$),a(T,M,$),a(T,m,$),B(p,T,$),a(T,G,$),a(T,A,$),a(T,H,$),B(Q,T,$),a(T,ul,$),a(T,v,$),a(T,D,$),B(V,T,$),a(T,rl,$),Y=!0},p:Bl,i(T){Y||(I(U.$$.fragment,T),I(p.$$.fragment,T),I(Q.$$.fragment,T),I(V.$$.fragment,T),Y=!0)},o(T){d(U.$$.fragment,T),d(p.$$.fragment,T),d(Q.$$.fragment,T),d(V.$$.fragment,T),Y=!1},d(T){T&&(n(r),n(i),n(c),n(J),n(M),n(m),n(G),n(A),n(H),n(ul),n(v),n(D),n(rl)),W(U,T),W(p,T),W(Q,T),W(V,T)}}}function ja(Z){let r,i,j,c,U,J,M,o="Dalam bagian ini, kita akan mengeksplorasi kerangka kerja lanjutan untuk mengoptimalkan penerapan LLM: Text Generation Inference (TGI), vLLM, dan llama.cpp. Aplikasi-aplikasi ini terutama digunakan di lingkungan produksi untuk menyajikan LLM kepada pengguna. Bagian ini berfokus pada cara menerapkan kerangka kerja tersebut di produksi, bukan cara menggunakannya untuk inferensi di mesin tunggal.",m,p,G="Kami akan membahas bagaimana alat-alat ini memaksimalkan efisiensi inferensi dan menyederhanakan penerapan Large Language Models di lingkungan produksi.",A,R,H,Q,ul="TGI, vLLM, dan llama.cpp memiliki tujuan serupa namun memiliki karakteristik yang berbeda, sehingga lebih cocok untuk berbagai kasus penggunaan. Mari kita lihat perbedaan utama antara mereka, dengan fokus pada kinerja dan integrasi.",v,X,D,V,rl="<strong>TGI</strong> dirancang agar stabil dan dapat diprediksi di lingkungan produksi, menggunakan panjang urutan tetap untuk menjaga penggunaan memori yang konsisten. TGI mengelola memori menggunakan Flash Attention 2 dan teknik continuous batching. Ini berarti ia dapat memproses perhitungan attention secara sangat efisien dan menjaga GPU tetap sibuk dengan terus memberikan pekerjaan. Sistem ini dapat memindahkan bagian model antara CPU dan GPU sesuai kebutuhan, yang membantu menangani model yang lebih besar.",Y,T,$='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/tgi/flash-attn.png" alt="Flash Attention"/>',nl,F,al,P,gl="<strong>vLLM</strong> menggunakan pendekatan berbeda dengan teknik bernama PagedAttention. Seperti sistem operasi mengelola memori dalam bentuk halaman, vLLM membagi memori model menjadi blok-blok kecil. Sistem cerdas ini memungkinkan penanganan permintaan berukuran berbeda secara fleksibel dan menghindari pemborosan memori. vLLM sangat efisien dalam berbagi memori antar permintaan dan mengurangi fragmentasi memori, menjadikan sistem lebih efisien secara keseluruhan.",el,q,sl,K,Il="<strong>llama.cpp</strong> adalah implementasi C/C++ yang sangat dioptimalkan, awalnya dirancang untuk menjalankan model LLaMA di perangkat konsumen. Fokusnya pada efisiensi CPU dengan dukungan opsional untuk akselerasi GPU, ideal untuk lingkungan dengan sumber daya terbatas. llama.cpp menggunakan teknik kuantisasi untuk mengurangi ukuran dan kebutuhan memori model sambil mempertahankan kinerja yang baik. Ia juga menyediakan kernel yang dioptimalkan untuk berbagai arsitektur CPU dan manajemen KV cache dasar untuk menghasilkan token secara efisien.",tl,_,Ml,O,jl,x,Ul="Sekarang mari kita bahas perbedaan penerapan dan integrasi antar kerangka kerja.",pl,ll,dl="<strong>TGI</strong> unggul dalam penerapan tingkat enterprise dengan fitur siap-produksi. Ini memiliki dukungan bawaan untuk Kubernetes, pemantauan dengan Prometheus dan Grafana, penskalaan otomatis, serta fitur keamanan lengkap. Logging tingkat enterprise dan fitur seperti penyaringan konten serta pembatasan laju (rate limiting) membuatnya aman dan stabil.",il,L,cl="<strong>vLLM</strong> menawarkan pendekatan yang lebih fleksibel dan ramah pengembang. Dibangun dengan Python sebagai inti, vLLM bisa dengan mudah menggantikan API OpenAI di aplikasi yang sudah ada. Cocok digunakan dengan Ray untuk mengelola klaster, sangat ideal saat Anda membutuhkan performa tinggi dan kemampuan kustomisasi.",wl,z,Jl="<strong>llama.cpp</strong> mengutamakan kesederhanaan dan portabilitas. Implementasi servernya ringan dan dapat dijalankan di berbagai perangkat — dari server bertenaga tinggi hingga laptop konsumen dan beberapa perangkat seluler kelas atas. Dengan ketergantungan minimal dan inti C/C++ sederhana, sangat mudah diterapkan di lingkungan yang sulit menginstal framework Python. Server ini kompatibel dengan API OpenAI sambil tetap memiliki jejak sumber daya yang jauh lebih kecil dibanding solusi lain.",ml,ol,s,b,Vl="Mari kita eksplorasi cara menggunakan kerangka kerja ini untuk menerapkan LLM, dimulai dari instalasi dan pengaturan dasar.",hl,Cl,kl,yl,fl,bl,e,g,Cn="Mari kita lihat contoh-contoh generasi teks dengan berbagai framework:",Ol,Wl,ln,Nl,nn,$l,an,Sl,kn="Proses generasi teks melibatkan pemilihan token berikutnya di setiap langkah. Proses ini bisa dikendalikan melalui berbagai parameter:",en,El,fn="<li><strong>Logit Mentah</strong>: Probabilitas awal untuk setiap token</li> <li><strong>Temperature</strong>: Mengatur tingkat kreativitas (semakin tinggi, semakin acak)</li> <li><strong>Top-p (Nucleus Sampling)</strong>: Memfilter token dengan probabilitas kumulatif X%</li> <li><strong>Top-k Filtering</strong>: Membatasi pilihan ke k token dengan kemungkinan tertinggi</li>",sn,vl,Bn="Berikut cara mengkonfigurasinya:",tn,Gl,Mn,Yl,pn,Rl,Wn="Semua framework menyediakan cara untuk mencegah generasi teks yang berulang:",mn,Zl,yn,Xl,un,Fl,Gn="Anda bisa mengontrol panjang generasi dan menetapkan titik berhenti:",rn,Al,Un,ql,Jn,_l,Zn="Ketiga kerangka kerja menerapkan teknik manajemen memori canggih untuk efisiensi inferensi.",on,Ql,cn,xl,Tn,Ll,An='<li><a href="https://huggingface.co/docs/text-generation-inference" rel="nofollow">Dokumentasi Text Generation Inference</a></li> <li><a href="https://github.com/huggingface/text-generation-inference" rel="nofollow">Repositori GitHub TGI</a></li> <li><a href="https://vllm.readthedocs.io/" rel="nofollow">Dokumentasi vLLM</a></li> <li><a href="https://github.com/vllm-project/vllm" rel="nofollow">Repositori GitHub vLLM</a></li> <li><a href="https://arxiv.org/abs/2309.06180" rel="nofollow">Makalah PagedAttention</a></li> <li><a href="https://github.com/ggerganov/llama.cpp" rel="nofollow">Repositori llama.cpp</a></li> <li><a href="https://github.com/abetlen/llama-cpp-python" rel="nofollow">Repositori llama-cpp-python</a></li>',jn,zl,wn,Pl,hn;return U=new Tl({props:{title:"Penerapan Inferensi yang Dioptimalkan",local:"penerapan-inferensi-yang-dioptimalkan",headingTag:"h1"}}),R=new Tl({props:{title:"Panduan Pemilihan Kerangka Kerja",local:"panduan-pemilihan-kerangka-kerja",headingTag:"h2"}}),X=new Tl({props:{title:"Manajemen Memori dan Performa",local:"manajemen-memori-dan-performa",headingTag:"h3"}}),F=new In({props:{title:"Cara Kerja Flash Attention",$$slots:{default:[ma]},$$scope:{ctx:Z}}}),q=new In({props:{title:"Cara Kerja PagedAttention",$$slots:{default:[ya]},$$scope:{ctx:Z}}}),_=new In({props:{title:"Cara Kerja Kuantisasi llama.cpp",$$slots:{default:[ua]},$$scope:{ctx:Z}}}),O=new Tl({props:{title:"Penerapan dan Integrasi",local:"penerapan-dan-integrasi",headingTag:"h3"}}),ol=new Tl({props:{title:"Memulai Penggunaan",local:"memulai-penggunaan",headingTag:"h2"}}),Cl=new Tl({props:{title:"Instalasi dan Pengaturan Dasar",local:"instalasi-dan-pengaturan-dasar",headingTag:"h3"}}),yl=new Hl({props:{id:"inference-frameworks",options:[],$$slots:{default:[ra]},$$scope:{ctx:Z}}}),bl=new Tl({props:{title:"Generasi Teks Dasar",local:"generasi-teks-dasar",headingTag:"h3"}}),Wl=new Hl({props:{id:"inference-frameworks",options:[],$$slots:{default:[Ua]},$$scope:{ctx:Z}}}),Nl=new Tl({props:{title:"Kontrol Generasi Lanjutan",local:"kontrol-generasi-lanjutan",headingTag:"h2"}}),$l=new Tl({props:{title:"Pemilihan Token dan Sampling",local:"pemilihan-token-dan-sampling",headingTag:"h3"}}),Gl=new Hl({props:{id:"inference-frameworks",options:[],$$slots:{default:[Ja]},$$scope:{ctx:Z}}}),Yl=new Tl({props:{title:"Mengontrol Pengulangan",local:"mengontrol-pengulangan",headingTag:"h3"}}),Zl=new Hl({props:{id:"inference-frameworks",options:[],$$slots:{default:[oa]},$$scope:{ctx:Z}}}),Xl=new Tl({props:{title:"Kontrol Panjang dan Stop Sequences",local:"kontrol-panjang-dan-stop-sequences",headingTag:"h3"}}),Al=new Hl({props:{id:"inference-frameworks",options:[],$$slots:{default:[ca]},$$scope:{ctx:Z}}}),ql=new Tl({props:{title:"Pengelolaan Memori",local:"pengelolaan-memori",headingTag:"h2"}}),Ql=new Hl({props:{id:"inference-frameworks",options:[],$$slots:{default:[Ta]},$$scope:{ctx:Z}}}),xl=new Tl({props:{title:"Sumber",local:"sumber",headingTag:"h2"}}),zl=new sa({props:{source:"https://github.com/huggingface/course/blob/main/chapters/id/chapter2/8.mdx"}}),{c(){r=w("meta"),i=y(),j=w("p"),c=y(),k(U.$$.fragment),J=y(),M=w("p"),M.textContent=o,m=y(),p=w("p"),p.textContent=G,A=y(),k(R.$$.fragment),H=y(),Q=w("p"),Q.textContent=ul,v=y(),k(X.$$.fragment),D=y(),V=w("p"),V.innerHTML=rl,Y=y(),T=w("p"),T.innerHTML=$,nl=y(),k(F.$$.fragment),al=y(),P=w("p"),P.innerHTML=gl,el=y(),k(q.$$.fragment),sl=y(),K=w("p"),K.innerHTML=Il,tl=y(),k(_.$$.fragment),Ml=y(),k(O.$$.fragment),jl=y(),x=w("p"),x.textContent=Ul,pl=y(),ll=w("p"),ll.innerHTML=dl,il=y(),L=w("p"),L.innerHTML=cl,wl=y(),z=w("p"),z.innerHTML=Jl,ml=y(),k(ol.$$.fragment),s=y(),b=w("p"),b.textContent=Vl,hl=y(),k(Cl.$$.fragment),kl=y(),k(yl.$$.fragment),fl=y(),k(bl.$$.fragment),e=y(),g=w("p"),g.textContent=Cn,Ol=y(),k(Wl.$$.fragment),ln=y(),k(Nl.$$.fragment),nn=y(),k($l.$$.fragment),an=y(),Sl=w("p"),Sl.textContent=kn,en=y(),El=w("ol"),El.innerHTML=fn,sn=y(),vl=w("p"),vl.textContent=Bn,tn=y(),k(Gl.$$.fragment),Mn=y(),k(Yl.$$.fragment),pn=y(),Rl=w("p"),Rl.textContent=Wn,mn=y(),k(Zl.$$.fragment),yn=y(),k(Xl.$$.fragment),un=y(),Fl=w("p"),Fl.textContent=Gn,rn=y(),k(Al.$$.fragment),Un=y(),k(ql.$$.fragment),Jn=y(),_l=w("p"),_l.textContent=Zn,on=y(),k(Ql.$$.fragment),cn=y(),k(xl.$$.fragment),Tn=y(),Ll=w("ul"),Ll.innerHTML=An,jn=y(),k(zl.$$.fragment),wn=y(),Pl=w("p"),this.h()},l(l){const t=ea("svelte-u9bgzb",document.head);r=h(t,"META",{name:!0,content:!0}),t.forEach(n),i=u(l),j=h(l,"P",{}),Kl(j).forEach(n),c=u(l),f(U.$$.fragment,l),J=u(l),M=h(l,"P",{"data-svelte-h":!0}),C(M)!=="svelte-1wtwj5n"&&(M.textContent=o),m=u(l),p=h(l,"P",{"data-svelte-h":!0}),C(p)!=="svelte-1evar45"&&(p.textContent=G),A=u(l),f(R.$$.fragment,l),H=u(l),Q=h(l,"P",{"data-svelte-h":!0}),C(Q)!=="svelte-1vlo0fn"&&(Q.textContent=ul),v=u(l),f(X.$$.fragment,l),D=u(l),V=h(l,"P",{"data-svelte-h":!0}),C(V)!=="svelte-yis6u"&&(V.innerHTML=rl),Y=u(l),T=h(l,"P",{"data-svelte-h":!0}),C(T)!=="svelte-1459ciq"&&(T.innerHTML=$),nl=u(l),f(F.$$.fragment,l),al=u(l),P=h(l,"P",{"data-svelte-h":!0}),C(P)!=="svelte-tn6cam"&&(P.innerHTML=gl),el=u(l),f(q.$$.fragment,l),sl=u(l),K=h(l,"P",{"data-svelte-h":!0}),C(K)!=="svelte-13ejjx8"&&(K.innerHTML=Il),tl=u(l),f(_.$$.fragment,l),Ml=u(l),f(O.$$.fragment,l),jl=u(l),x=h(l,"P",{"data-svelte-h":!0}),C(x)!=="svelte-qz8pxd"&&(x.textContent=Ul),pl=u(l),ll=h(l,"P",{"data-svelte-h":!0}),C(ll)!=="svelte-rv3kgi"&&(ll.innerHTML=dl),il=u(l),L=h(l,"P",{"data-svelte-h":!0}),C(L)!=="svelte-1inp4hu"&&(L.innerHTML=cl),wl=u(l),z=h(l,"P",{"data-svelte-h":!0}),C(z)!=="svelte-h34c74"&&(z.innerHTML=Jl),ml=u(l),f(ol.$$.fragment,l),s=u(l),b=h(l,"P",{"data-svelte-h":!0}),C(b)!=="svelte-kazfin"&&(b.textContent=Vl),hl=u(l),f(Cl.$$.fragment,l),kl=u(l),f(yl.$$.fragment,l),fl=u(l),f(bl.$$.fragment,l),e=u(l),g=h(l,"P",{"data-svelte-h":!0}),C(g)!=="svelte-5t2ln2"&&(g.textContent=Cn),Ol=u(l),f(Wl.$$.fragment,l),ln=u(l),f(Nl.$$.fragment,l),nn=u(l),f($l.$$.fragment,l),an=u(l),Sl=h(l,"P",{"data-svelte-h":!0}),C(Sl)!=="svelte-1xgb8sl"&&(Sl.textContent=kn),en=u(l),El=h(l,"OL",{"data-svelte-h":!0}),C(El)!=="svelte-ujr52"&&(El.innerHTML=fn),sn=u(l),vl=h(l,"P",{"data-svelte-h":!0}),C(vl)!=="svelte-j38dlc"&&(vl.textContent=Bn),tn=u(l),f(Gl.$$.fragment,l),Mn=u(l),f(Yl.$$.fragment,l),pn=u(l),Rl=h(l,"P",{"data-svelte-h":!0}),C(Rl)!=="svelte-v2tann"&&(Rl.textContent=Wn),mn=u(l),f(Zl.$$.fragment,l),yn=u(l),f(Xl.$$.fragment,l),un=u(l),Fl=h(l,"P",{"data-svelte-h":!0}),C(Fl)!=="svelte-tnmnza"&&(Fl.textContent=Gn),rn=u(l),f(Al.$$.fragment,l),Un=u(l),f(ql.$$.fragment,l),Jn=u(l),_l=h(l,"P",{"data-svelte-h":!0}),C(_l)!=="svelte-4f5155"&&(_l.textContent=Zn),on=u(l),f(Ql.$$.fragment,l),cn=u(l),f(xl.$$.fragment,l),Tn=u(l),Ll=h(l,"UL",{"data-svelte-h":!0}),C(Ll)!=="svelte-1eojzuk"&&(Ll.innerHTML=An),jn=u(l),f(zl.$$.fragment,l),wn=u(l),Pl=h(l,"P",{}),Kl(Pl).forEach(n),this.h()},h(){Dl(r,"name","hf:doc:metadata"),Dl(r,"content",wa)},m(l,t){dn(document.head,r),a(l,i,t),a(l,j,t),a(l,c,t),B(U,l,t),a(l,J,t),a(l,M,t),a(l,m,t),a(l,p,t),a(l,A,t),B(R,l,t),a(l,H,t),a(l,Q,t),a(l,v,t),B(X,l,t),a(l,D,t),a(l,V,t),a(l,Y,t),a(l,T,t),a(l,nl,t),B(F,l,t),a(l,al,t),a(l,P,t),a(l,el,t),B(q,l,t),a(l,sl,t),a(l,K,t),a(l,tl,t),B(_,l,t),a(l,Ml,t),B(O,l,t),a(l,jl,t),a(l,x,t),a(l,pl,t),a(l,ll,t),a(l,il,t),a(l,L,t),a(l,wl,t),a(l,z,t),a(l,ml,t),B(ol,l,t),a(l,s,t),a(l,b,t),a(l,hl,t),B(Cl,l,t),a(l,kl,t),B(yl,l,t),a(l,fl,t),B(bl,l,t),a(l,e,t),a(l,g,t),a(l,Ol,t),B(Wl,l,t),a(l,ln,t),B(Nl,l,t),a(l,nn,t),B($l,l,t),a(l,an,t),a(l,Sl,t),a(l,en,t),a(l,El,t),a(l,sn,t),a(l,vl,t),a(l,tn,t),B(Gl,l,t),a(l,Mn,t),B(Yl,l,t),a(l,pn,t),a(l,Rl,t),a(l,mn,t),B(Zl,l,t),a(l,yn,t),B(Xl,l,t),a(l,un,t),a(l,Fl,t),a(l,rn,t),B(Al,l,t),a(l,Un,t),B(ql,l,t),a(l,Jn,t),a(l,_l,t),a(l,on,t),B(Ql,l,t),a(l,cn,t),B(xl,l,t),a(l,Tn,t),a(l,Ll,t),a(l,jn,t),B(zl,l,t),a(l,wn,t),a(l,Pl,t),hn=!0},p(l,[t]){const Qn={};t&2&&(Qn.$$scope={dirty:t,ctx:l}),F.$set(Qn);const Vn={};t&2&&(Vn.$$scope={dirty:t,ctx:l}),q.$set(Vn);const Nn={};t&2&&(Nn.$$scope={dirty:t,ctx:l}),_.$set(Nn);const $n={};t&2&&($n.$$scope={dirty:t,ctx:l}),yl.$set($n);const Sn={};t&2&&(Sn.$$scope={dirty:t,ctx:l}),Wl.$set(Sn);const En={};t&2&&(En.$$scope={dirty:t,ctx:l}),Gl.$set(En);const vn={};t&2&&(vn.$$scope={dirty:t,ctx:l}),Zl.$set(vn);const Yn={};t&2&&(Yn.$$scope={dirty:t,ctx:l}),Al.$set(Yn);const Rn={};t&2&&(Rn.$$scope={dirty:t,ctx:l}),Ql.$set(Rn)},i(l){hn||(I(U.$$.fragment,l),I(R.$$.fragment,l),I(X.$$.fragment,l),I(F.$$.fragment,l),I(q.$$.fragment,l),I(_.$$.fragment,l),I(O.$$.fragment,l),I(ol.$$.fragment,l),I(Cl.$$.fragment,l),I(yl.$$.fragment,l),I(bl.$$.fragment,l),I(Wl.$$.fragment,l),I(Nl.$$.fragment,l),I($l.$$.fragment,l),I(Gl.$$.fragment,l),I(Yl.$$.fragment,l),I(Zl.$$.fragment,l),I(Xl.$$.fragment,l),I(Al.$$.fragment,l),I(ql.$$.fragment,l),I(Ql.$$.fragment,l),I(xl.$$.fragment,l),I(zl.$$.fragment,l),hn=!0)},o(l){d(U.$$.fragment,l),d(R.$$.fragment,l),d(X.$$.fragment,l),d(F.$$.fragment,l),d(q.$$.fragment,l),d(_.$$.fragment,l),d(O.$$.fragment,l),d(ol.$$.fragment,l),d(Cl.$$.fragment,l),d(yl.$$.fragment,l),d(bl.$$.fragment,l),d(Wl.$$.fragment,l),d(Nl.$$.fragment,l),d($l.$$.fragment,l),d(Gl.$$.fragment,l),d(Yl.$$.fragment,l),d(Zl.$$.fragment,l),d(Xl.$$.fragment,l),d(Al.$$.fragment,l),d(ql.$$.fragment,l),d(Ql.$$.fragment,l),d(xl.$$.fragment,l),d(zl.$$.fragment,l),hn=!1},d(l){l&&(n(i),n(j),n(c),n(J),n(M),n(m),n(p),n(A),n(H),n(Q),n(v),n(D),n(V),n(Y),n(T),n(nl),n(al),n(P),n(el),n(sl),n(K),n(tl),n(Ml),n(jl),n(x),n(pl),n(ll),n(il),n(L),n(wl),n(z),n(ml),n(s),n(b),n(hl),n(kl),n(fl),n(e),n(g),n(Ol),n(ln),n(nn),n(an),n(Sl),n(en),n(El),n(sn),n(vl),n(tn),n(Mn),n(pn),n(Rl),n(mn),n(yn),n(un),n(Fl),n(rn),n(Un),n(Jn),n(_l),n(on),n(cn),n(Tn),n(Ll),n(jn),n(wn),n(Pl)),n(r),W(U,l),W(R,l),W(X,l),W(F,l),W(q,l),W(_,l),W(O,l),W(ol,l),W(Cl,l),W(yl,l),W(bl,l),W(Wl,l),W(Nl,l),W($l,l),W(Gl,l),W(Yl,l),W(Zl,l),W(Xl,l),W(Al,l),W(ql,l),W(Ql,l),W(xl,l),W(zl,l)}}}const wa='{"title":"Penerapan Inferensi yang Dioptimalkan","local":"penerapan-inferensi-yang-dioptimalkan","sections":[{"title":"Panduan Pemilihan Kerangka Kerja","local":"panduan-pemilihan-kerangka-kerja","sections":[{"title":"Manajemen Memori dan Performa","local":"manajemen-memori-dan-performa","sections":[],"depth":3},{"title":"Penerapan dan Integrasi","local":"penerapan-dan-integrasi","sections":[],"depth":3}],"depth":2},{"title":"Memulai Penggunaan","local":"memulai-penggunaan","sections":[{"title":"Instalasi dan Pengaturan Dasar","local":"instalasi-dan-pengaturan-dasar","sections":[],"depth":3},{"title":"Generasi Teks Dasar","local":"generasi-teks-dasar","sections":[],"depth":3}],"depth":2},{"title":"Kontrol Generasi Lanjutan","local":"kontrol-generasi-lanjutan","sections":[{"title":"Pemilihan Token dan Sampling","local":"pemilihan-token-dan-sampling","sections":[],"depth":3},{"title":"Mengontrol Pengulangan","local":"mengontrol-pengulangan","sections":[],"depth":3},{"title":"Kontrol Panjang dan Stop Sequences","local":"kontrol-panjang-dan-stop-sequences","sections":[],"depth":3}],"depth":2},{"title":"Pengelolaan Memori","local":"pengelolaan-memori","sections":[],"depth":2},{"title":"Sumber","local":"sumber","sections":[],"depth":2}],"depth":1}';function ha(Z){return xn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ba extends Ln{constructor(r){super(),zn(this,r,ha,ja,_n,{})}}export{Ba as component};
