import{s as Ee,o as ze,n as gt}from"../chunks/scheduler.bdbef820.js";import{S as Ae,i as Ie,g as T,s as o,r as d,A as He,h,f as l,c as i,j as Fe,u,x as w,k as Qe,y as Le,a as n,v as c,d as M,t as y,w as $}from"../chunks/index.33f81d56.js";import{T as ce}from"../chunks/Tip.34194030.js";import{C as B}from"../chunks/CodeBlock.362b34a4.js";import{H as X,E as qe}from"../chunks/EditOnGithub.a9246e21.js";import{H as Ve,a as ue}from"../chunks/HfOption.6b792247.js";function xe(_){let s,f;return s=new B({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGFjY2VsZXJhdGUlMjBiaXRzYW5kYnl0ZXMlM0UwLjM3LjA=",highlighted:"pip install transformers accelerate bitsandbytes&gt;0.37.0",wrap:!1}}),{c(){d(s.$$.fragment)},l(a){u(s.$$.fragment,a)},m(a,r){c(s,a,r),f=!0},p:gt,i(a){f||(M(s.$$.fragment,a),f=!0)},o(a){y(s.$$.fragment,a),f=!1},d(a){$(s,a)}}}function Ye(_){let s,f;return s=new B({props:{code:"cGlwJTIwaW5zdGFsbCUyMGJpdHNhbmRieXRlcyUzRSUzRDAuMzkuMCUwQXBpcCUyMGluc3RhbGwlMjAtLXVwZ3JhZGUlMjBhY2NlbGVyYXRlJTIwdHJhbnNmb3JtZXJz",highlighted:`pip install bitsandbytes&gt;=0.39.0
pip install --upgrade accelerate transformers`,wrap:!1}}),{c(){d(s.$$.fragment)},l(a){u(s.$$.fragment,a)},m(a,r){c(s,a,r),f=!0},p:gt,i(a){f||(M(s.$$.fragment,a),f=!0)},o(a){y(s.$$.fragment,a),f=!1},d(a){$(s,a)}}}function Se(_){let s,f,a,r;return s=new ue({props:{id:"bnb",option:"8-bit",$$slots:{default:[xe]},$$scope:{ctx:_}}}),a=new ue({props:{id:"bnb",option:"4-bit",$$slots:{default:[Ye]},$$scope:{ctx:_}}}),{c(){d(s.$$.fragment),f=o(),d(a.$$.fragment)},l(m){u(s.$$.fragment,m),f=i(m),u(a.$$.fragment,m)},m(m,J){c(s,m,J),n(m,f,J),c(a,m,J),r=!0},p(m,J){const Z={};J&2&&(Z.$$scope={dirty:J,ctx:m}),s.$set(Z);const C={};J&2&&(C.$$scope={dirty:J,ctx:m}),a.$set(C)},i(m){r||(M(s.$$.fragment,m),M(a.$$.fragment,m),r=!0)},o(m){y(s.$$.fragment,m),y(a.$$.fragment,m),r=!1},d(m){m&&l(f),$(s,m),$(a,m)}}}function Pe(_){let s,f="모델을 8비트로 양자화하면 메모리 사용량이 절반으로 줄어들며, 대규모 모델의 경우 사용 가능한 GPU를 효율적으로 활용하려면 <code>device_map=&quot;auto&quot;</code>를 설정하세요.",a,r,m,J,Z="기본적으로 <code>torch.nn.LayerNorm</code>과 같은 다른 모듈은 <code>torch.float16</code>으로 변환됩니다. 원한다면 <code>torch_dtype</code> 매개변수로 이들 모듈의 데이터 유형을 변경할 수 있습니다:",C,U,W,j,k='모델이 8비트로 양자화되면 최신 버전의 Transformers와 bitsandbytes를 사용하지 않는 한 양자화된 가중치를 Hub에 푸시할 수 없습니다. 최신 버전을 사용하는 경우, <a href="/docs/transformers/main/ko/main_classes/model#transformers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> 메소드를 사용하여 8비트 모델을 Hub에 푸시할 수 있습니다. 양자화 config.json 파일이 먼저 푸시되고, 그 다음 양자화된 모델 가중치가 푸시됩니다.',v,p,g;return r=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyhsb2FkX2luXzhiaXQlM0RUcnVlKSUwQSUwQW1vZGVsXzhiaXQlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyYmlnc2NpZW5jZSUyRmJsb29tLTFiNyUyMiUyQyUyMCUwQSUyMCUyMCUyMCUyMHF1YW50aXphdGlvbl9jb25maWclM0RxdWFudGl6YXRpb25fY29uZmlnJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>)

model_8bit = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>, 
    quantization_config=quantization_config
)`,wrap:!1}}),U=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBCaXRzQW5kQnl0ZXNDb25maWclMEElMEFxdWFudGl6YXRpb25fY29uZmlnJTIwJTNEJTIwQml0c0FuZEJ5dGVzQ29uZmlnKGxvYWRfaW5fOGJpdCUzRFRydWUpJTBBJTBBbW9kZWxfOGJpdCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyJTJDJTIwJTBBJTIwJTIwJTIwJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWclMkMlMjAlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MzIlMEEpJTBBbW9kZWxfOGJpdC5tb2RlbC5kZWNvZGVyLmxheWVycyU1Qi0xJTVELmZpbmFsX2xheWVyX25vcm0ud2VpZ2h0LmR0eXBl",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>)

model_8bit = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;facebook/opt-350m&quot;</span>, 
    quantization_config=quantization_config, 
    torch_dtype=torch.float32
)
model_8bit.model.decoder.layers[-<span class="hljs-number">1</span>].final_layer_norm.weight.dtype`,wrap:!1}}),p=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcobG9hZF9pbl84Yml0JTNEVHJ1ZSklMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJiaWdzY2llbmNlJTJGYmxvb20tNTYwbSUyMiUyQyUyMCUwQSUyMCUyMCUyMCUyMHF1YW50aXphdGlvbl9jb25maWclM0RxdWFudGl6YXRpb25fY29uZmlnJTBBKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ3NjaWVuY2UlMkZibG9vbS01NjBtJTIyKSUwQSUwQW1vZGVsLnB1c2hfdG9faHViKCUyMmJsb29tLTU2MG0tOGJpdCUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>)

model = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;bigscience/bloom-560m&quot;</span>, 
    quantization_config=quantization_config
)
tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bigscience/bloom-560m&quot;</span>)

model.push_to_hub(<span class="hljs-string">&quot;bloom-560m-8bit&quot;</span>)`,wrap:!1}}),{c(){s=T("p"),s.innerHTML=f,a=o(),d(r.$$.fragment),m=o(),J=T("p"),J.innerHTML=Z,C=o(),d(U.$$.fragment),W=o(),j=T("p"),j.innerHTML=k,v=o(),d(p.$$.fragment)},l(b){s=h(b,"P",{"data-svelte-h":!0}),w(s)!=="svelte-bdtlp"&&(s.innerHTML=f),a=i(b),u(r.$$.fragment,b),m=i(b),J=h(b,"P",{"data-svelte-h":!0}),w(J)!=="svelte-171qp9u"&&(J.innerHTML=Z),C=i(b),u(U.$$.fragment,b),W=i(b),j=h(b,"P",{"data-svelte-h":!0}),w(j)!=="svelte-167fosh"&&(j.innerHTML=k),v=i(b),u(p.$$.fragment,b)},m(b,R){n(b,s,R),n(b,a,R),c(r,b,R),n(b,m,R),n(b,J,R),n(b,C,R),c(U,b,R),n(b,W,R),n(b,j,R),n(b,v,R),c(p,b,R),g=!0},p:gt,i(b){g||(M(r.$$.fragment,b),M(U.$$.fragment,b),M(p.$$.fragment,b),g=!0)},o(b){y(r.$$.fragment,b),y(U.$$.fragment,b),y(p.$$.fragment,b),g=!1},d(b){b&&(l(s),l(a),l(m),l(J),l(C),l(W),l(j),l(v)),$(r,b),$(U,b),$(p,b)}}}function De(_){let s,f="모델을 4비트로 양자화하면 메모리 사용량이 4배 줄어들며, 대규모 모델의 경우 사용 가능한 GPU를 효율적으로 활용하려면 <code>device_map=&quot;auto&quot;</code>를 설정하세요:",a,r,m,J,Z="기본적으로 <code>torch.nn.LayerNorm</code>과 같은 다른 모듈은 <code>torch.float16</code>으로 변환됩니다. 원한다면 <code>torch_dtype</code> 매개변수로 이들 모듈의 데이터 유형을 변경할 수 있습니다:",C,U,W,j,k="<code>bitsandbytes&gt;=0.41.3</code>을 사용하는 경우 4비트 모델을 직렬화하고 Hugging Face Hub에 푸시할 수 있습니다. 모델을 4비트 정밀도로 가져온 후 <code>model.push_to_hub()</code>를 호출하면 됩니다. 또한 <code>model.save_pretrained()</code> 명령어로 로컬에 직렬화된 4비트 모델을 저장할 수도 있습니다.",v;return r=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyhsb2FkX2luXzRiaXQlM0RUcnVlKSUwQSUwQW1vZGVsXzRiaXQlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyYmlnc2NpZW5jZSUyRmJsb29tLTFiNyUyMiUyQyUwQSUyMCUyMCUyMCUyMHF1YW50aXphdGlvbl9jb25maWclM0RxdWFudGl6YXRpb25fY29uZmlnJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_4bit=<span class="hljs-literal">True</span>)

model_4bit = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>,
    quantization_config=quantization_config
)`,wrap:!1}}),U=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBCaXRzQW5kQnl0ZXNDb25maWclMEElMEFxdWFudGl6YXRpb25fY29uZmlnJTIwJTNEJTIwQml0c0FuZEJ5dGVzQ29uZmlnKGxvYWRfaW5fNGJpdCUzRFRydWUpJTBBJTBBbW9kZWxfNGJpdCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyJTJDJTBBJTIwJTIwJTIwJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWclMkMlMjAlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MzIlMEEpJTBBbW9kZWxfNGJpdC5tb2RlbC5kZWNvZGVyLmxheWVycyU1Qi0xJTVELmZpbmFsX2xheWVyX25vcm0ud2VpZ2h0LmR0eXBl",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_4bit=<span class="hljs-literal">True</span>)

model_4bit = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;facebook/opt-350m&quot;</span>,
    quantization_config=quantization_config, 
    torch_dtype=torch.float32
)
model_4bit.model.decoder.layers[-<span class="hljs-number">1</span>].final_layer_norm.weight.dtype`,wrap:!1}}),{c(){s=T("p"),s.innerHTML=f,a=o(),d(r.$$.fragment),m=o(),J=T("p"),J.innerHTML=Z,C=o(),d(U.$$.fragment),W=o(),j=T("p"),j.innerHTML=k},l(p){s=h(p,"P",{"data-svelte-h":!0}),w(s)!=="svelte-8aquvh"&&(s.innerHTML=f),a=i(p),u(r.$$.fragment,p),m=i(p),J=h(p,"P",{"data-svelte-h":!0}),w(J)!=="svelte-171qp9u"&&(J.innerHTML=Z),C=i(p),u(U.$$.fragment,p),W=i(p),j=h(p,"P",{"data-svelte-h":!0}),w(j)!=="svelte-1e678s0"&&(j.innerHTML=k)},m(p,g){n(p,s,g),n(p,a,g),c(r,p,g),n(p,m,g),n(p,J,g),n(p,C,g),c(U,p,g),n(p,W,g),n(p,j,g),v=!0},p:gt,i(p){v||(M(r.$$.fragment,p),M(U.$$.fragment,p),v=!0)},o(p){y(r.$$.fragment,p),y(U.$$.fragment,p),v=!1},d(p){p&&(l(s),l(a),l(m),l(J),l(C),l(W),l(j)),$(r,p),$(U,p)}}}function Ke(_){let s,f,a,r;return s=new ue({props:{id:"bnb",option:"8-bit",$$slots:{default:[Pe]},$$scope:{ctx:_}}}),a=new ue({props:{id:"bnb",option:"4-bit",$$slots:{default:[De]},$$scope:{ctx:_}}}),{c(){d(s.$$.fragment),f=o(),d(a.$$.fragment)},l(m){u(s.$$.fragment,m),f=i(m),u(a.$$.fragment,m)},m(m,J){c(s,m,J),n(m,f,J),c(a,m,J),r=!0},p(m,J){const Z={};J&2&&(Z.$$scope={dirty:J,ctx:m}),s.$set(Z);const C={};J&2&&(C.$$scope={dirty:J,ctx:m}),a.$set(C)},i(m){r||(M(s.$$.fragment,m),M(a.$$.fragment,m),r=!0)},o(m){y(s.$$.fragment,m),y(a.$$.fragment,m),r=!1},d(m){m&&l(f),$(s,m),$(a,m)}}}function Oe(_){let s,f="8비트 및 4비트 가중치로 훈련하는 것은 <em>추가</em> 매개변수에 대해서만 지원됩니다.";return{c(){s=T("p"),s.innerHTML=f},l(a){s=h(a,"P",{"data-svelte-h":!0}),w(s)!=="svelte-kie4hd"&&(s.innerHTML=f)},m(a,r){n(a,s,r)},p:gt,d(a){a&&l(s)}}}function tl(_){let s,f='8비트 양자화에 대한 자세한 내용을 알고 싶다면 이 <a href="https://huggingface.co/blog/hf-bitsandbytes-integration" rel="nofollow">블로그 포스트</a>를 참조하세요!';return{c(){s=T("p"),s.innerHTML=f},l(a){s=h(a,"P",{"data-svelte-h":!0}),w(s)!=="svelte-wzc4n7"&&(s.innerHTML=f)},m(a,r){n(a,s,r)},p:gt,d(a){a&&l(s)}}}function el(_){let s,f='이 <a href="https://colab.research.google.com/drive/1ge2F1QSK8Q7h0hn3YKuBCOAS0bK8E0wf" rel="nofollow">노트북</a>에서 4비트 양자화를 시도해보고 자세한 내용은 이 <a href="https://huggingface.co/blog/4bit-transformers-bitsandbytes" rel="nofollow">블로그 게시물</a>에서 확인하세요.';return{c(){s=T("p"),s.innerHTML=f},l(a){s=h(a,"P",{"data-svelte-h":!0}),w(s)!=="svelte-1hh56xn"&&(s.innerHTML=f)},m(a,r){n(a,s,r)},p:gt,d(a){a&&l(s)}}}function ll(_){let s,f,a,r,m,J,Z,C='<a href="https://github.com/TimDettmers/bitsandbytes" rel="nofollow">bitsandbytes</a>는 모델을 8비트 및 4비트로 양자화하는 가장 쉬운 방법입니다. 8비트 양자화는 fp16의 이상치와 int8의 비이상치를 곱한 후, 비이상치 값을 fp16으로 다시 변환하고, 이들을 합산하여 fp16으로 가중치를 반환합니다. 이렇게 하면 이상치 값이 모델 성능에 미치는 저하 효과를 줄일 수 있습니다. 4비트 양자화는 모델을 더욱 압축하며, <a href="https://hf.co/papers/2305.14314" rel="nofollow">QLoRA</a>와 함께 사용하여 양자화된 대규모 언어 모델을 미세 조정하는 데 흔히 사용됩니다.',U,W,j="bitsandbytes를 사용하려면 다음 라이브러리가 설치되어 있어야 합니다:",k,v,p,g,b='이제 <code>BitsAndBytesConfig</code>를 <a href="/docs/transformers/main/ko/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> 메소드에 전달하여 모델을 양자화할 수 있습니다. 이는 Accelerate 가져오기를 지원하고 <code>torch.nn.Linear</code> 레이어가 포함된 모든 모델에서 작동합니다.',R,G,Ut,N,Zt,V,Me="메모리 사용량을 확인하려면 <code>get_memory_footprint</code>를 사용하세요:",Ct,E,jt,z,ye='양자화된 모델은 <a href="/docs/transformers/main/ko/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> 메소드를 사용하여 <code>load_in_8bit</code> 또는 <code>load_in_4bit</code> 매개변수를 지정하지 않고도 가져올 수 있습니다:',vt,A,Bt,I,Wt,F,Rt,H,$e="이 섹션에서는 오프로딩, 이상치 임곗값, 모듈 변환 건너뛰기 및 미세 조정과 같은 8비트 모델의 특정 기능을 살펴봅니다.",Xt,L,kt,q,Je='8비트 모델은 CPU와 GPU 간에 가중치를 오프로드하여 매우 큰 모델을 메모리에 장착할 수 있습니다. CPU로 전송된 가중치는 실제로 <strong>float32</strong>로 저장되며 8비트로 변환되지 않습니다. 예를 들어, <a href="https://huggingface.co/bigscience/bloom-1b7" rel="nofollow">bigscience/bloom-1b7</a> 모델의 오프로드를 활성화하려면 <a href="/docs/transformers/main/ko/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>를 생성하는 것부터 시작하세요:',Gt,x,Nt,Y,Te="CPU에 전달할 <code>lm_head</code>를 제외한 모든 것을 GPU에 적재할 수 있도록 사용자 정의 디바이스 맵을 설계합니다:",Ft,S,Qt,P,he="이제 사용자 정의 <code>device_map</code>과 <code>quantization_config</code>을 사용하여 모델을 가져옵니다:",Vt,D,Et,K,zt,O,we="“이상치”는 특정 임곗값을 초과하는 은닉 상태 값을 의미하며, 이러한 값은 fp16으로 계산됩니다. 값은 일반적으로 정규 분포 ([-3.5, 3.5])를 따르지만, 대규모 모델의 경우 이 분포는 매우 다를 수 있습니다 ([-60, 6] 또는 [6, 60]). 8비트 양자화는 ~5 정도의 값에서 잘 작동하지만, 그 이상에서는 상당한 성능 저하가 발생합니다. 좋은 기본 임곗값 값은 6이지만, 더 불안정한 모델 (소형 모델 또는 미세 조정)에는 더 낮은 임곗값이 필요할 수 있습니다.",At,tt,ge='모델에 가장 적합한 임곗값을 찾으려면 <a href="/docs/transformers/main/ko/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>에서 <code>llm_int8_threshold</code> 매개변수를 실험해보는 것이 좋습니다:',It,et,Ht,lt,Lt,nt,_e='<a href="model_doc/jukebox">Jukebox</a>와 같은 일부 모델은 모든 모듈을 8비트로 양자화할 필요가 없으며, 이는 실제로 불안정성을 유발할 수 있습니다. Jukebox의 경우, <a href="/docs/transformers/main/ko/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>의 <code>llm_int8_skip_modules</code> 매개변수를 사용하여 여러 <code>lm_head</code> 모듈을 건너뛰어야 합니다:',qt,st,xt,at,Yt,ot,Ue='<a href="https://github.com/huggingface/peft" rel="nofollow">PEFT</a> 라이브러리를 사용하면 <a href="https://huggingface.co/google/flan-t5-large" rel="nofollow">flan-t5-large</a> 및 <a href="https://huggingface.co/facebook/opt-6.7b" rel="nofollow">facebook/opt-6.7b</a>와 같은 대규모 모델을 8비트 양자화로 미세 조정할 수 있습니다. 훈련 시 <code>device_map</code> 매개변수를 전달할 필요가 없으며, 모델을 자동으로 GPU에 가져옵니다. 그러나 원하는 경우 <code>device_map</code> 매개변수로 장치 맵을 사용자 정의할 수 있습니다 (<code>device_map=&quot;auto&quot;</code>는 추론에만 사용해야 합니다).',St,it,Pt,Q,Dt,mt,Ze="이 섹션에서는 계산 데이터 유형 변경, Normal Float 4 (NF4) 데이터 유형 사용, 중첩 양자화 사용과 같은 4비트 모델의 특정 기능 일부를 탐구합니다.",Kt,pt,Ot,rt,Ce='계산 속도를 높이기 위해 <a href="/docs/transformers/main/ko/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>에서 <code>bnb_4bit_compute_dtype</code> 매개변수를 사용하여 데이터 유형을 float32(기본값)에서 bf16으로 변경할 수 있습니다:',te,ft,ee,bt,le,dt,je='NF4는 <a href="https://hf.co/papers/2305.14314" rel="nofollow">QLoRA</a> 논문에서 소개된 4비트 데이터 유형으로, 정규 분포에서 초기화된 가중치에 적합합니다. 4비트 기반 모델을 훈련할 때 NF4를 사용해야 합니다. 이는 <a href="/docs/transformers/main/ko/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>에서 <code>bnb_4bit_quant_type</code> 매개변수로 설정할 수 있습니다:',ne,ut,se,ct,ve="추론의 경우, <code>bnb_4bit_quant_type</code>은 성능에 큰 영향을 미치지 않습니다. 그러나 모델 가중치와 일관성을 유지하기 위해 <code>bnb_4bit_compute_dtype</code> 및 <code>torch_dtype</code> 값을 사용해야 합니다.",ae,Mt,oe,yt,Be='중첩 양자화는 추가적인 성능 손실 없이 추가적인 메모리를 절약할 수 있는 기술입니다. 이 기능은 이미 양자화된 가중치의 2차 양자화를 수행하여 매개변수당 추가로 0.4비트를 절약합니다. 예를 들어, 중첩 양자화를 통해 16GB NVIDIA T4 GPU에서 시퀀스 길이 1024, 배치 크기 1, 그레이디언트 누적 4단계를 사용하여 <a href="https://huggingface.co/meta-llama/Llama-2-13b" rel="nofollow">Llama-13b</a> 모델을 미세 조정할 수 있습니다.',ie,$t,me,Jt,pe,Tt,We="양자화된 후에는 모델을 원래의 정밀도로 비양자화할 수 있지만, 이는 모델의 품질이 약간 저하될 수 있습니다. 비양자화된 모델에 맞출 수 있는 충분한 GPU RAM이 있는지 확인하세요.",re,ht,fe,wt,be,_t,de;return m=new X({props:{title:"bitsandbytes",local:"bitsandbytes",headingTag:"h1"}}),v=new Ve({props:{id:"bnb",options:["8-bit","4-bit"],$$slots:{default:[Se]},$$scope:{ctx:_}}}),G=new Ve({props:{id:"bnb",options:["8-bit","4-bit"],$$slots:{default:[Ke]},$$scope:{ctx:_}}}),N=new ce({props:{warning:!0,$$slots:{default:[Oe]},$$scope:{ctx:_}}}),E=new B({props:{code:"cHJpbnQobW9kZWwuZ2V0X21lbW9yeV9mb290cHJpbnQoKSk=",highlighted:'<span class="hljs-built_in">print</span>(model.get_memory_footprint())',wrap:!1}}),A=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMiU3QnlvdXJfdXNlcm5hbWUlN0QlMkZibG9vbS01NjBtLThiaXQlMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;{your_username}/bloom-560m-8bit&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)`,wrap:!1}}),I=new X({props:{title:"8비트 (LLM.int8() 알고리즘)",local:"8-bit-(llm.int8()-algorithm)",headingTag:"h2"}}),F=new ce({props:{$$slots:{default:[tl]},$$scope:{ctx:_}}}),L=new X({props:{title:"오프로딩",local:"offloading",headingTag:"h3"}}),x=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyhsbG1faW50OF9lbmFibGVfZnAzMl9jcHVfb2ZmbG9hZCUzRFRydWUp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(llm_int8_enable_fp32_cpu_offload=<span class="hljs-literal">True</span>)`,wrap:!1}}),S=new B({props:{code:"ZGV2aWNlX21hcCUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMnRyYW5zZm9ybWVyLndvcmRfZW1iZWRkaW5ncyUyMiUzQSUyMDAlMkMlMEElMjAlMjAlMjAlMjAlMjJ0cmFuc2Zvcm1lci53b3JkX2VtYmVkZGluZ3NfbGF5ZXJub3JtJTIyJTNBJTIwMCUyQyUwQSUyMCUyMCUyMCUyMCUyMmxtX2hlYWQlMjIlM0ElMjAlMjJjcHUlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJ0cmFuc2Zvcm1lci5oJTIyJTNBJTIwMCUyQyUwQSUyMCUyMCUyMCUyMCUyMnRyYW5zZm9ybWVyLmxuX2YlMjIlM0ElMjAwJTJDJTBBJTdE",highlighted:`device_map = {
    <span class="hljs-string">&quot;transformer.word_embeddings&quot;</span>: <span class="hljs-number">0</span>,
    <span class="hljs-string">&quot;transformer.word_embeddings_layernorm&quot;</span>: <span class="hljs-number">0</span>,
    <span class="hljs-string">&quot;lm_head&quot;</span>: <span class="hljs-string">&quot;cpu&quot;</span>,
    <span class="hljs-string">&quot;transformer.h&quot;</span>: <span class="hljs-number">0</span>,
    <span class="hljs-string">&quot;transformer.ln_f&quot;</span>: <span class="hljs-number">0</span>,
}`,wrap:!1}}),D=new B({props:{code:"bW9kZWxfOGJpdCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJiaWdzY2llbmNlJTJGYmxvb20tMWI3JTIyJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRGRldmljZV9tYXAlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSk=",highlighted:`model_8bit = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>,
    device_map=device_map,
    quantization_config=quantization_config,
)`,wrap:!1}}),K=new X({props:{title:"이상치 임곗값",local:"outlier-threshold",headingTag:"h3"}}),et=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJiaWdzY2llbmNlJTJGYmxvb20tMWI3JTIyJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyglMEElMjAlMjAlMjAlMjBsbG1faW50OF90aHJlc2hvbGQlM0QxMCUyQyUwQSklMEElMEFtb2RlbF84Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lkJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRGRldmljZV9tYXAlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig

model_id = <span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>

quantization_config = BitsAndBytesConfig(
    llm_int8_threshold=<span class="hljs-number">10</span>,
)

model_8bit = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map=device_map,
    quantization_config=quantization_config,
)`,wrap:!1}}),lt=new X({props:{title:"모듈 변환 건너뛰기",local:"skip-module-conversion",headingTag:"h3"}}),st=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyYmlnc2NpZW5jZSUyRmJsb29tLTFiNyUyMiUwQSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbGxtX2ludDhfc2tpcF9tb2R1bGVzJTNEJTVCJTIybG1faGVhZCUyMiU1RCUyQyUwQSklMEElMEFtb2RlbF84Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lkJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

model_id = <span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>

quantization_config = BitsAndBytesConfig(
    llm_int8_skip_modules=[<span class="hljs-string">&quot;lm_head&quot;</span>],
)

model_8bit = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
    quantization_config=quantization_config,
)`,wrap:!1}}),at=new X({props:{title:"미세 조정",local:"finetuning",headingTag:"h3"}}),it=new X({props:{title:"4비트 (QLoRA 알고리즘)",local:"4-bit-(qlora-algorithm)",headingTag:"h2"}}),Q=new ce({props:{$$slots:{default:[el]},$$scope:{ctx:_}}}),pt=new X({props:{title:"데이터 유형 계산",local:"compute-data-type",headingTag:"h3"}}),ft=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyhsb2FkX2luXzRiaXQlM0RUcnVlJTJDJTIwYm5iXzRiaXRfY29tcHV0ZV9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_4bit=<span class="hljs-literal">True</span>, bnb_4bit_compute_dtype=torch.bfloat16)`,wrap:!1}}),bt=new X({props:{title:"Normal Float 4 (NF4)",local:"normal-float-4-(nf4)",headingTag:"h3"}}),ut=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQW5mNF9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbG9hZF9pbl80Yml0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJuYl80Yml0X3F1YW50X3R5cGUlM0QlMjJuZjQlMjIlMkMlMEEpJTBBJTBBbW9kZWxfbmY0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRG5mNF9jb25maWcp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitsAndBytesConfig

nf4_config = BitsAndBytesConfig(
    load_in_4bit=<span class="hljs-literal">True</span>,
    bnb_4bit_quant_type=<span class="hljs-string">&quot;nf4&quot;</span>,
)

model_nf4 = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=nf4_config)`,wrap:!1}}),Mt=new X({props:{title:"중첩 양자화",local:"nested-quantization",headingTag:"h3"}}),$t=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQWRvdWJsZV9xdWFudF9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbG9hZF9pbl80Yml0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJuYl80Yml0X3VzZV9kb3VibGVfcXVhbnQlM0RUcnVlJTJDJTBBKSUwQSUwQW1vZGVsX2RvdWJsZV9xdWFudCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJtZXRhLWxsYW1hJTJGTGxhbWEtMi0xM2IlMjIlMkMlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEZG91YmxlX3F1YW50X2NvbmZpZyk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitsAndBytesConfig

double_quant_config = BitsAndBytesConfig(
    load_in_4bit=<span class="hljs-literal">True</span>,
    bnb_4bit_use_double_quant=<span class="hljs-literal">True</span>,
)

model_double_quant = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;meta-llama/Llama-2-13b&quot;</span>, quantization_config=double_quant_config)`,wrap:!1}}),Jt=new X({props:{title:"bitsandbytes 모델의 비양자화",local:"dequantizing- bitsandbytes -models",headingTag:"h2"}}),ht=new B({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyZmFjZWJvb2slMkZvcHQtMTI1bSUyMiUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnKGxvYWRfaW5fNGJpdCUzRFRydWUpKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQSUwQW1vZGVsLmRlcXVhbnRpemUoKSUwQSUwQXRleHQlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMjBteSUyMG5hbWUlMjBpcyUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKDApJTBBJTBBb3V0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKip0ZXh0KSUwQXByaW50KHRva2VuaXplci5kZWNvZGUob3V0JTVCMCU1RCkp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig, AutoTokenizer

model_id = <span class="hljs-string">&quot;facebook/opt-125m&quot;</span>

model = AutoModelForCausalLM.from_pretrained(model_id, BitsAndBytesConfig(load_in_4bit=<span class="hljs-literal">True</span>))
tokenizer = AutoTokenizer.from_pretrained(model_id)

model.dequantize()

text = tokenizer(<span class="hljs-string">&quot;Hello my name is&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(<span class="hljs-number">0</span>)

out = model.generate(**text)
<span class="hljs-built_in">print</span>(tokenizer.decode(out[<span class="hljs-number">0</span>]))`,wrap:!1}}),wt=new qe({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ko/quantization/bitsandbytes.md"}}),{c(){s=T("meta"),f=o(),a=T("p"),r=o(),d(m.$$.fragment),J=o(),Z=T("p"),Z.innerHTML=C,U=o(),W=T("p"),W.textContent=j,k=o(),d(v.$$.fragment),p=o(),g=T("p"),g.innerHTML=b,R=o(),d(G.$$.fragment),Ut=o(),d(N.$$.fragment),Zt=o(),V=T("p"),V.innerHTML=Me,Ct=o(),d(E.$$.fragment),jt=o(),z=T("p"),z.innerHTML=ye,vt=o(),d(A.$$.fragment),Bt=o(),d(I.$$.fragment),Wt=o(),d(F.$$.fragment),Rt=o(),H=T("p"),H.textContent=$e,Xt=o(),d(L.$$.fragment),kt=o(),q=T("p"),q.innerHTML=Je,Gt=o(),d(x.$$.fragment),Nt=o(),Y=T("p"),Y.innerHTML=Te,Ft=o(),d(S.$$.fragment),Qt=o(),P=T("p"),P.innerHTML=he,Vt=o(),d(D.$$.fragment),Et=o(),d(K.$$.fragment),zt=o(),O=T("p"),O.textContent=we,At=o(),tt=T("p"),tt.innerHTML=ge,It=o(),d(et.$$.fragment),Ht=o(),d(lt.$$.fragment),Lt=o(),nt=T("p"),nt.innerHTML=_e,qt=o(),d(st.$$.fragment),xt=o(),d(at.$$.fragment),Yt=o(),ot=T("p"),ot.innerHTML=Ue,St=o(),d(it.$$.fragment),Pt=o(),d(Q.$$.fragment),Dt=o(),mt=T("p"),mt.textContent=Ze,Kt=o(),d(pt.$$.fragment),Ot=o(),rt=T("p"),rt.innerHTML=Ce,te=o(),d(ft.$$.fragment),ee=o(),d(bt.$$.fragment),le=o(),dt=T("p"),dt.innerHTML=je,ne=o(),d(ut.$$.fragment),se=o(),ct=T("p"),ct.innerHTML=ve,ae=o(),d(Mt.$$.fragment),oe=o(),yt=T("p"),yt.innerHTML=Be,ie=o(),d($t.$$.fragment),me=o(),d(Jt.$$.fragment),pe=o(),Tt=T("p"),Tt.textContent=We,re=o(),d(ht.$$.fragment),fe=o(),d(wt.$$.fragment),be=o(),_t=T("p"),this.h()},l(t){const e=He("svelte-u9bgzb",document.head);s=h(e,"META",{name:!0,content:!0}),e.forEach(l),f=i(t),a=h(t,"P",{}),Fe(a).forEach(l),r=i(t),u(m.$$.fragment,t),J=i(t),Z=h(t,"P",{"data-svelte-h":!0}),w(Z)!=="svelte-2xjbe9"&&(Z.innerHTML=C),U=i(t),W=h(t,"P",{"data-svelte-h":!0}),w(W)!=="svelte-vl7bne"&&(W.textContent=j),k=i(t),u(v.$$.fragment,t),p=i(t),g=h(t,"P",{"data-svelte-h":!0}),w(g)!=="svelte-1rgezq8"&&(g.innerHTML=b),R=i(t),u(G.$$.fragment,t),Ut=i(t),u(N.$$.fragment,t),Zt=i(t),V=h(t,"P",{"data-svelte-h":!0}),w(V)!=="svelte-1y7utg9"&&(V.innerHTML=Me),Ct=i(t),u(E.$$.fragment,t),jt=i(t),z=h(t,"P",{"data-svelte-h":!0}),w(z)!=="svelte-175uh19"&&(z.innerHTML=ye),vt=i(t),u(A.$$.fragment,t),Bt=i(t),u(I.$$.fragment,t),Wt=i(t),u(F.$$.fragment,t),Rt=i(t),H=h(t,"P",{"data-svelte-h":!0}),w(H)!=="svelte-kgzuf7"&&(H.textContent=$e),Xt=i(t),u(L.$$.fragment,t),kt=i(t),q=h(t,"P",{"data-svelte-h":!0}),w(q)!=="svelte-91llel"&&(q.innerHTML=Je),Gt=i(t),u(x.$$.fragment,t),Nt=i(t),Y=h(t,"P",{"data-svelte-h":!0}),w(Y)!=="svelte-1r5a1v6"&&(Y.innerHTML=Te),Ft=i(t),u(S.$$.fragment,t),Qt=i(t),P=h(t,"P",{"data-svelte-h":!0}),w(P)!=="svelte-1ovfvxr"&&(P.innerHTML=he),Vt=i(t),u(D.$$.fragment,t),Et=i(t),u(K.$$.fragment,t),zt=i(t),O=h(t,"P",{"data-svelte-h":!0}),w(O)!=="svelte-6mtmjt"&&(O.textContent=we),At=i(t),tt=h(t,"P",{"data-svelte-h":!0}),w(tt)!=="svelte-phauky"&&(tt.innerHTML=ge),It=i(t),u(et.$$.fragment,t),Ht=i(t),u(lt.$$.fragment,t),Lt=i(t),nt=h(t,"P",{"data-svelte-h":!0}),w(nt)!=="svelte-13ho4ga"&&(nt.innerHTML=_e),qt=i(t),u(st.$$.fragment,t),xt=i(t),u(at.$$.fragment,t),Yt=i(t),ot=h(t,"P",{"data-svelte-h":!0}),w(ot)!=="svelte-kqzf4t"&&(ot.innerHTML=Ue),St=i(t),u(it.$$.fragment,t),Pt=i(t),u(Q.$$.fragment,t),Dt=i(t),mt=h(t,"P",{"data-svelte-h":!0}),w(mt)!=="svelte-1v64cgw"&&(mt.textContent=Ze),Kt=i(t),u(pt.$$.fragment,t),Ot=i(t),rt=h(t,"P",{"data-svelte-h":!0}),w(rt)!=="svelte-1yan5zn"&&(rt.innerHTML=Ce),te=i(t),u(ft.$$.fragment,t),ee=i(t),u(bt.$$.fragment,t),le=i(t),dt=h(t,"P",{"data-svelte-h":!0}),w(dt)!=="svelte-xhdj24"&&(dt.innerHTML=je),ne=i(t),u(ut.$$.fragment,t),se=i(t),ct=h(t,"P",{"data-svelte-h":!0}),w(ct)!=="svelte-w9lp1j"&&(ct.innerHTML=ve),ae=i(t),u(Mt.$$.fragment,t),oe=i(t),yt=h(t,"P",{"data-svelte-h":!0}),w(yt)!=="svelte-1p3ohva"&&(yt.innerHTML=Be),ie=i(t),u($t.$$.fragment,t),me=i(t),u(Jt.$$.fragment,t),pe=i(t),Tt=h(t,"P",{"data-svelte-h":!0}),w(Tt)!=="svelte-1t95noe"&&(Tt.textContent=We),re=i(t),u(ht.$$.fragment,t),fe=i(t),u(wt.$$.fragment,t),be=i(t),_t=h(t,"P",{}),Fe(_t).forEach(l),this.h()},h(){Qe(s,"name","hf:doc:metadata"),Qe(s,"content",nl)},m(t,e){Le(document.head,s),n(t,f,e),n(t,a,e),n(t,r,e),c(m,t,e),n(t,J,e),n(t,Z,e),n(t,U,e),n(t,W,e),n(t,k,e),c(v,t,e),n(t,p,e),n(t,g,e),n(t,R,e),c(G,t,e),n(t,Ut,e),c(N,t,e),n(t,Zt,e),n(t,V,e),n(t,Ct,e),c(E,t,e),n(t,jt,e),n(t,z,e),n(t,vt,e),c(A,t,e),n(t,Bt,e),c(I,t,e),n(t,Wt,e),c(F,t,e),n(t,Rt,e),n(t,H,e),n(t,Xt,e),c(L,t,e),n(t,kt,e),n(t,q,e),n(t,Gt,e),c(x,t,e),n(t,Nt,e),n(t,Y,e),n(t,Ft,e),c(S,t,e),n(t,Qt,e),n(t,P,e),n(t,Vt,e),c(D,t,e),n(t,Et,e),c(K,t,e),n(t,zt,e),n(t,O,e),n(t,At,e),n(t,tt,e),n(t,It,e),c(et,t,e),n(t,Ht,e),c(lt,t,e),n(t,Lt,e),n(t,nt,e),n(t,qt,e),c(st,t,e),n(t,xt,e),c(at,t,e),n(t,Yt,e),n(t,ot,e),n(t,St,e),c(it,t,e),n(t,Pt,e),c(Q,t,e),n(t,Dt,e),n(t,mt,e),n(t,Kt,e),c(pt,t,e),n(t,Ot,e),n(t,rt,e),n(t,te,e),c(ft,t,e),n(t,ee,e),c(bt,t,e),n(t,le,e),n(t,dt,e),n(t,ne,e),c(ut,t,e),n(t,se,e),n(t,ct,e),n(t,ae,e),c(Mt,t,e),n(t,oe,e),n(t,yt,e),n(t,ie,e),c($t,t,e),n(t,me,e),c(Jt,t,e),n(t,pe,e),n(t,Tt,e),n(t,re,e),c(ht,t,e),n(t,fe,e),c(wt,t,e),n(t,be,e),n(t,_t,e),de=!0},p(t,[e]){const Re={};e&2&&(Re.$$scope={dirty:e,ctx:t}),v.$set(Re);const Xe={};e&2&&(Xe.$$scope={dirty:e,ctx:t}),G.$set(Xe);const ke={};e&2&&(ke.$$scope={dirty:e,ctx:t}),N.$set(ke);const Ge={};e&2&&(Ge.$$scope={dirty:e,ctx:t}),F.$set(Ge);const Ne={};e&2&&(Ne.$$scope={dirty:e,ctx:t}),Q.$set(Ne)},i(t){de||(M(m.$$.fragment,t),M(v.$$.fragment,t),M(G.$$.fragment,t),M(N.$$.fragment,t),M(E.$$.fragment,t),M(A.$$.fragment,t),M(I.$$.fragment,t),M(F.$$.fragment,t),M(L.$$.fragment,t),M(x.$$.fragment,t),M(S.$$.fragment,t),M(D.$$.fragment,t),M(K.$$.fragment,t),M(et.$$.fragment,t),M(lt.$$.fragment,t),M(st.$$.fragment,t),M(at.$$.fragment,t),M(it.$$.fragment,t),M(Q.$$.fragment,t),M(pt.$$.fragment,t),M(ft.$$.fragment,t),M(bt.$$.fragment,t),M(ut.$$.fragment,t),M(Mt.$$.fragment,t),M($t.$$.fragment,t),M(Jt.$$.fragment,t),M(ht.$$.fragment,t),M(wt.$$.fragment,t),de=!0)},o(t){y(m.$$.fragment,t),y(v.$$.fragment,t),y(G.$$.fragment,t),y(N.$$.fragment,t),y(E.$$.fragment,t),y(A.$$.fragment,t),y(I.$$.fragment,t),y(F.$$.fragment,t),y(L.$$.fragment,t),y(x.$$.fragment,t),y(S.$$.fragment,t),y(D.$$.fragment,t),y(K.$$.fragment,t),y(et.$$.fragment,t),y(lt.$$.fragment,t),y(st.$$.fragment,t),y(at.$$.fragment,t),y(it.$$.fragment,t),y(Q.$$.fragment,t),y(pt.$$.fragment,t),y(ft.$$.fragment,t),y(bt.$$.fragment,t),y(ut.$$.fragment,t),y(Mt.$$.fragment,t),y($t.$$.fragment,t),y(Jt.$$.fragment,t),y(ht.$$.fragment,t),y(wt.$$.fragment,t),de=!1},d(t){t&&(l(f),l(a),l(r),l(J),l(Z),l(U),l(W),l(k),l(p),l(g),l(R),l(Ut),l(Zt),l(V),l(Ct),l(jt),l(z),l(vt),l(Bt),l(Wt),l(Rt),l(H),l(Xt),l(kt),l(q),l(Gt),l(Nt),l(Y),l(Ft),l(Qt),l(P),l(Vt),l(Et),l(zt),l(O),l(At),l(tt),l(It),l(Ht),l(Lt),l(nt),l(qt),l(xt),l(Yt),l(ot),l(St),l(Pt),l(Dt),l(mt),l(Kt),l(Ot),l(rt),l(te),l(ee),l(le),l(dt),l(ne),l(se),l(ct),l(ae),l(oe),l(yt),l(ie),l(me),l(pe),l(Tt),l(re),l(fe),l(be),l(_t)),l(s),$(m,t),$(v,t),$(G,t),$(N,t),$(E,t),$(A,t),$(I,t),$(F,t),$(L,t),$(x,t),$(S,t),$(D,t),$(K,t),$(et,t),$(lt,t),$(st,t),$(at,t),$(it,t),$(Q,t),$(pt,t),$(ft,t),$(bt,t),$(ut,t),$(Mt,t),$($t,t),$(Jt,t),$(ht,t),$(wt,t)}}}const nl='{"title":"bitsandbytes","local":"bitsandbytes","sections":[{"title":"8비트 (LLM.int8() 알고리즘)","local":"8-bit-(llm.int8()-algorithm)","sections":[{"title":"오프로딩","local":"offloading","sections":[],"depth":3},{"title":"이상치 임곗값","local":"outlier-threshold","sections":[],"depth":3},{"title":"모듈 변환 건너뛰기","local":"skip-module-conversion","sections":[],"depth":3},{"title":"미세 조정","local":"finetuning","sections":[],"depth":3}],"depth":2},{"title":"4비트 (QLoRA 알고리즘)","local":"4-bit-(qlora-algorithm)","sections":[{"title":"데이터 유형 계산","local":"compute-data-type","sections":[],"depth":3},{"title":"Normal Float 4 (NF4)","local":"normal-float-4-(nf4)","sections":[],"depth":3},{"title":"중첩 양자화","local":"nested-quantization","sections":[],"depth":3}],"depth":2},{"title":"bitsandbytes 모델의 비양자화","local":"dequantizing- bitsandbytes -models","sections":[],"depth":2}],"depth":1}';function sl(_){return ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fl extends Ae{constructor(s){super(),Ie(this,s,sl,ll,Ee,{})}}export{fl as component};
