import{s as ul,o as fl,n as ol}from"../chunks/scheduler.d9d004e7.js";import{S as rl,i as Ml,e as s,s as i,c as o,h as dl,a as p,d as l,b as n,f as pl,g as u,j as m,k as xt,l as hl,m as a,n as f,t as r,o as M,p as d,q as yl,r as Ul}from"../chunks/index.4a2b774c.js";import{T as ml}from"../chunks/Tip.cf0287e4.js";import{C as wl,H as g,E as cl}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c93fcd94.js";import{C as c}from"../chunks/CodeBlock.8bd69f21.js";function Tl(Ie){let h,T=`Visit <a href="https://docs.habana.ai/en/latest/Release_Notes/GAUDI_Release_Notes.html">Intel Gaudi AI Accelerator Release Notes</a>
page to get the latest Intel Gaudi AI accelerator software release version. Alternatively, check`,U,w,J="https://vault.habana.ai/ui/native/gaudi-docker",b;return{c(){h=s("p"),h.innerHTML=T,U=i(),w=s("a"),w.textContent=J,b=yl(`
for the list of all released Intel® Gaudi® AI accelerator docker images.`),this.h()},l(y){h=p(y,"P",{"data-svelte-h":!0}),m(h)!=="svelte-ibh9s1"&&(h.innerHTML=T),U=n(y),w=p(y,"A",{href:!0,"data-svelte-h":!0}),m(w)!=="svelte-1pfp99s"&&(w.textContent=J),b=Ul(y,`
for the list of all released Intel® Gaudi® AI accelerator docker images.`),this.h()},h(){xt(w,"href","https://vault.habana.ai/ui/native/gaudi-docker")},m(y,C){a(y,h,C),a(y,U,C),a(y,w,C),a(y,b,C)},p:ol,d(y){y&&(l(h),l(U),l(w),l(b))}}}function Jl(Ie){let h,T="The list of all possible arguments can be obtained running the script with —help";return{c(){h=s("p"),h.textContent=T},l(U){h=p(U,"P",{"data-svelte-h":!0}),m(h)!=="svelte-zk3y69"&&(h.textContent=T)},m(U,w){a(U,h,w)},p:ol,d(U){U&&l(h)}}}function bl(Ie){let h,T,U,w,J,b,y,C,_,Gt=`Running your AI workloads on Intel® Gaudi® accelerators can be accomplished in just a few simple steps.
In this quick guide, we show how to run inference with GPT-2 model on Intel Gaudi 2 accelerators using the 🤗 Optimum for Intel Gaudi library.`,_e,x,jt=`Optimum for Intel Gaudi library is optimized for running various AI workloads on Intel Gaudi accelerators and it contains fully documented
inference, training and fine-tuning examples. Please refer to the <a href="https://github.com/huggingface/optimum-habana" rel="nofollow">Optimum for Intel Gaudi GitHub</a>
page for more information.`,xe,G,Ge,j,Zt=`To access an Intel Gaudi AI accelerator node in the Intel® Tiber™ AI Cloud, you will go to
<a href="https://console.cloud.intel.com/hardware" rel="nofollow">Intel Tiber AI Cloud</a> and access the hardware instances to select the Intel Gaudi AI accelerator
platform for deep learning and follow the steps to start and connect to the node.`,je,Z,Ze,v,vt=`Now that you have access to the node, you will use the latest Intel Gaudi AI Accelerator docker image by executing the docker run command which will
automatically download and run the docker. At the time of writing this guide, latest Gaudi docker version was 1.22.0:`,ve,X,Xe,I,Be,B,Xt="Execute docker run command:",We,W,Ve,V,Ae,A,Bt=`Check latest release of Optimum for Intel Gaudi <a href="https://github.com/huggingface/optimum-habana/releases" rel="nofollow">here</a>.
At the time of writing this guide, latest Optimum for Intel Gaudi release version was v1.19.0, which is paired with Intel Gaudi Software release
version 1.22.0.  Install Optimum for Intel Gaudi as follows:`,Se,S,Re,R,Wt='All available examples are under <a href="/examples">optimum-habana/examples</a>.',ke,k,Vt=`Here is <a href="/examples/text-generation">text-generation</a> example,
to run Llama-2 7B text generation example on Gaudi, complete the prerequisite setup:`,Ye,Y,Le,L,At='To be able to run gated models like <a href="https://huggingface.co/meta-llama/Llama-2-7b-hf" rel="nofollow">Llama-2 7B</a>, you should:',Ee,E,St='<li>Have a 🤗 account</li> <li>Agree to the terms of use of the model in its <a href="https://huggingface.co/meta-llama/Llama-2-7b-hf" rel="nofollow">model card</a></li> <li>Set your token as explained <a href="https://huggingface.co/docs/hub/security-tokens" rel="nofollow">here</a></li> <li>Login to your account using the HF CLI: run <code>huggingface-cli login</code> before launching your script</li>',Ne,N,He,H,Rt="Run single Gaudi device (HPU) inference with Llama-2 7B model:",Fe,F,Qe,$,ze,Q,De,z,kt=`With a multi-device Gaudi system, such as one with 8 HPUs, you can perform distributed inference using libraries like
Microsoft® DeepSpeed. Gaudi-specific fork of the library is maintained by Intel at
<a href="https://github.com/HabanaAI/DeepSpeed" rel="nofollow">https://github.com/HabanaAI/DeepSpeed</a>.`,Pe,D,Yt="To install the library compatible with the same Gaudi software release stack, use:",qe,P,Oe,q,Lt="With DeepSpeed successfully installed we can now run a distributed GPT-2 inference on an 8 HPU system as follows:",Ke,O,et,K,tt,ee,Et="🤗 Optimum for Intel Gaudi contains a number of examples demonstrating single and multi Gaudi device training/fine-tuning.",lt,te,Nt=`For example, a number of language models can be trained with the scripts provided
<a href="/examples/language-modeling">language modeling examples section</a>.`,at,le,Ht="As an illustration, let us run GPT-2 single and multi card training examples on Gaudi.",it,ae,Ft="Install prerequisites with:",nt,ie,st,ne,Qt="To train GPT-2 model on a single card, use:",pt,se,mt,pe,zt="To train GPT-2 model using multi-card Gaudi system:",ot,me,ut,oe,ft,ue,Dt=`🤗 Optimum for Intel Gaudi also features HPU-optimized support for the 🤗 Diffusers library.
Thus, you can deploy Stable Diffusion and similar diffusion models on Gaudi and enable
text-to-image generation and other diffusion-based workloads.`,rt,fe,Pt="Before running Stable Diffusion inference example on Gaudi, complete the prerequisite setup:",Mt,re,dt,Me,qt="Here is an example of running Stable Diffusion text to image inference on Gaudi:",ht,de,yt,he,Ot=`Also, here is an example of modifying a basic 🤗 Diffusers Stable Diffusion pipeline call to work with Gaudi
using the Optimum for Intel Gaudi library:`,Ut,ye,wt,Ue,Kt=`In addition, sample scripts for fine-tuning diffusion models are given in
<a href="/examples/stable-diffusion/training">Stable Diffusion training section</a>.`,ct,we,el="A more comprehensive list of examples in Optimum for Intel Gaudi is given next.",Tt,ce,Jt,Te,tl=`Now that you have run a full inference case, you can go back to the
<a href="https://github.com/huggingface/optimum-habana?tab=readme-ov-file#validated-models" rel="nofollow">Optimum for Intel Gaudi validated models</a>
to see more options for running inference.`,bt,Je,ll="Here are examples for various modalities and tasks that can be used out of the box:",Ct,be,al='<li><p><strong>Text</strong></p> <ul><li><a href="/examples/language-modeling">language modeling</a></li> <li><a href="/examples/multi-node-training">multi node training</a></li> <li><a href="/examples/protein-folding">protein folding</a></li> <li><a href="/examples/question-answering">question answering</a></li> <li><a href="/examples/sentence-transformers-training">sentence transformers training</a></li> <li><a href="/examples/summarization">summarization</a></li> <li><a href="/examples/table-detection">table detection</a></li> <li><a href="/examples/text-classification">text classification</a></li> <li><a href="/examples/text-feature-extraction">text feature extraction</a></li> <li><a href="/examples/text-generation">text generation</a></li> <li><a href="/examples/translation">translation</a></li> <li><a href="/examples/trl">trl</a></li></ul></li> <li><p><strong>Audio</strong></p> <ul><li><a href="/examples/audio-classification">audio classification</a></li> <li><a href="/examples/speech-recognition">speech recognition</a></li> <li><a href="/examples/text-to-speech">text to speech</a></li></ul></li> <li><p><strong>Images</strong></p> <ul><li><a href="/examples/object-detection">object detection</a></li> <li><a href="/examples/object-segementation">object segementation</a></li> <li><a href="/examples/image-classification">image classification</a></li> <li><a href="/examples/image-to-text">image to text</a></li> <li><a href="/examples/contrastive-image-text">contrastive image text</a></li> <li><a href="/examples/stable-diffusion">stable diffusion</a></li> <li><a href="/examples/visual-question-answering">visual question answering</a></li> <li><a href="/examples/zero-shot-object-detection">zero-shot object detection</a></li></ul></li> <li><p><strong>Video</strong></p> <ul><li><a href="/examples/stable-diffusion">stable-video-diffusion</a></li> <li><a href="/examples/video-classification">video-classification</a></li></ul></li>',gt,Ce,il=`To learn more about how to adapt 🤗 Transformers or Diffusers scripts for Intel Gaudi, check out
<a href="https://huggingface.co/docs/optimum/habana/usage_guides/script_adaptation" rel="nofollow">Script Adaptation</a> guide.`,It,ge,$t,$e,_t;return J=new wl({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new g({props:{title:"Quickstart",local:"quickstart",headingTag:"h1"}}),G=new g({props:{title:"Accessing Intel Gaudi AI Accelerator",local:"accessing-intel-gaudi-ai-accelerator",headingTag:"h2"}}),Z=new g({props:{title:"Docker Setup",local:"docker-setup",headingTag:"h2"}}),X=new c({props:{code:"cmVsZWFzZSUzRDEuMjIuMCUwQW9zJTNEdWJ1bnR1MjIuMDQlMEF0b3JjaCUzRDIuNy4xJTBBZG9ja2VyX2ltYWdlJTNEdmF1bHQuaGFiYW5hLmFpJTJGZ2F1ZGktZG9ja2VyJTJGJTI0cmVsZWFzZSUyRiUyNG9zJTJGaGFiYW5hbGFicyUyRnB5dG9yY2gtaW5zdGFsbGVyLSUyNHRvcmNoJTNBbGF0ZXN0",highlighted:`release=1.22.0
os=ubuntu22.04
torch=2.7.1
docker_image=vault.habana.ai/gaudi-docker/<span class="hljs-variable">$release</span>/<span class="hljs-variable">$os</span>/habanalabs/pytorch-installer-<span class="hljs-variable">$torch</span>:latest`,wrap:!1}}),I=new ml({props:{$$slots:{default:[Tl]},$$scope:{ctx:Ie}}}),W=new c({props:{code:"ZG9ja2VyJTIwcnVuJTIwLWl0ZCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbmFtZSUyMEdhdWRpX0RvY2tlciUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcnVudGltZSUzRGhhYmFuYSUyMCU1QyUwQSUyMCUyMCUyMCUyMC1lJTIwSEFCQU5BX1ZJU0lCTEVfREVWSUNFUyUzRGFsbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC1lJTIwT01QSV9NQ0FfYnRsX3ZhZGVyX3NpbmdsZV9jb3B5X21lY2hhbmlzbSUzRG5vbmUlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWNhcC1hZGQlM0RzeXNfbmljZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbmV0JTNEaG9zdCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0taXBjJTNEaG9zdCUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyNCU3QmRvY2tlcl9pbWFnZSU3RA==",highlighted:`docker run -itd \\
    --name Gaudi_Docker \\
    --runtime=habana \\
    -e HABANA_VISIBLE_DEVICES=all \\
    -e OMPI_MCA_btl_vader_single_copy_mechanism=none \\
    --cap-add=sys_nice \\
    --net=host \\
    --ipc=host \\
    <span class="hljs-variable">\${docker_image}</span>`,wrap:!1}}),V=new g({props:{title:"Optimum for Intel Gaudi Setup",local:"optimum-for-intel-gaudi-setup",headingTag:"h2"}}),S=new c({props:{code:"Z2l0JTIwY2xvbmUlMjAtYiUyMHYxLjE5LjAlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRm9wdGltdW0taGFiYW5hJTBBcGlwJTIwaW5zdGFsbCUyMC4lMkZvcHRpbXVtLWhhYmFuYQ==",highlighted:`git <span class="hljs-built_in">clone</span> -b v1.19.0 https://github.com/huggingface/optimum-habana
pip install ./optimum-habana`,wrap:!1}}),Y=new c({props:{code:"Y2QlMjB+JTJGb3B0aW11bS1oYWJhbmElMkZleGFtcGxlcyUyRnRleHQtZ2VuZXJhdGlvbiUwQXBpcCUyMGluc3RhbGwlMjAtciUyMHJlcXVpcmVtZW50cy50eHQ=",highlighted:`<span class="hljs-built_in">cd</span> ~/optimum-habana/examples/text-generation
pip install -r requirements.txt`,wrap:!1}}),N=new g({props:{title:"Single Device Inference",local:"single-device-inference",headingTag:"h2"}}),F=new c({props:{code:"UFRfSFBVX0xBWllfTU9ERSUzRDElMjBweXRob24lMjBydW5fZ2VuZXJhdGlvbi5weSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwbWV0YS1sbGFtYSUyRkxsYW1hLTItN2ItaGYlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXVzZV9ocHVfZ3JhcGhzJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS11c2Vfa3ZfY2FjaGUlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1heF9uZXdfdG9rZW5zJTIwMTAwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb19zYW1wbGUlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXByb21wdCUyMCUyMkhlcmUlMjBpcyUyMG15JTIwcHJvbXB0JTIy",highlighted:`PT_HPU_LAZY_MODE=1 python run_generation.py \\
    --model_name_or_path meta-llama/Llama-2-7b-hf \\
    --use_hpu_graphs \\
    --use_kv_cache \\
    --max_new_tokens 100 \\
    --do_sample \\
    --prompt <span class="hljs-string">&quot;Here is my prompt&quot;</span>`,wrap:!1}}),$=new ml({props:{$$slots:{default:[Jl]},$$scope:{ctx:Ie}}}),Q=new g({props:{title:"Multi-Device Inference",local:"multi-device-inference",headingTag:"h2"}}),P=new c({props:{code:"cGlwJTIwaW5zdGFsbCUyMGdpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRkhhYmFuYUFJJTJGRGVlcFNwZWVkLmdpdCU0MDEuMjIuMA==",highlighted:"pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.22.0",wrap:!1}}),O=new c({props:{code:"bnVtYmVyX29mX2RldmljZXMlM0Q4JTIwJTVDJTBBUFRfSFBVX0xBWllfTU9ERSUzRDElMjBweXRob24lMjAuLiUyRmdhdWRpX3NwYXduLnB5JTIwLS11c2VfZGVlcHNwZWVkJTIwLS13b3JsZF9zaXplJTIwJTI0JTdCbnVtYmVyX29mX2RldmljZXMlN0QlMjAlNUMlMEFydW5fZ2VuZXJhdGlvbi5weSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwbWV0YS1sbGFtYSUyRkxsYW1hLTItN2ItaGYlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXVzZV9ocHVfZ3JhcGhzJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS11c2Vfa3ZfY2FjaGUlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1heF9uZXdfdG9rZW5zJTNEMTAwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb19zYW1wbGUlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXByb21wdCUzRCUyMkhlcmUlMjBpcyUyMG15JTIwcHJvbXB0JTIy",highlighted:`number_of_devices=8 \\
PT_HPU_LAZY_MODE=1 python ../gaudi_spawn.py --use_deepspeed --world_size <span class="hljs-variable">\${number_of_devices}</span> \\
run_generation.py \\
    --model_name_or_path meta-llama/Llama-2-7b-hf \\
    --use_hpu_graphs \\
    --use_kv_cache \\
    --max_new_tokens=100 \\
    --do_sample \\
    --prompt=<span class="hljs-string">&quot;Here is my prompt&quot;</span>`,wrap:!1}}),K=new g({props:{title:"Training on Gaudi",local:"training-on-gaudi",headingTag:"h2"}}),ie=new c({props:{code:"Y2QlMjB+JTJGb3B0aW11bS1oYWJhbmElMkZleGFtcGxlcyUyRmxhbmd1YWdlLW1vZGVsaW5nJTBBcGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:`<span class="hljs-built_in">cd</span> ~/optimum-habana/examples/language-modeling
pip install -r requirements.txt`,wrap:!1}}),se=new c({props:{code:"UFRfSFBVX0xBWllfTU9ERSUzRDElMjBweXRob24lMjBydW5fY2xtLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBncHQyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X25hbWUlMjB3aWtpdGV4dCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9jb25maWdfbmFtZSUyMHdpa2l0ZXh0LTItcmF3LXYxJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlMjA0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUyMDQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX3RyYWluJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb19ldmFsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwJTJGdG1wJTJGdGVzdC1jbG0lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWdhdWRpX2NvbmZpZ19uYW1lJTIwSGFiYW5hJTJGZ3B0MiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdXNlX2hhYmFuYSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdXNlX2xhenlfbW9kZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdXNlX2hwdV9ncmFwaHNfZm9yX2luZmVyZW5jZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdGhyb3VnaHB1dF93YXJtdXBfc3RlcHMlMjAz",highlighted:`PT_HPU_LAZY_MODE=1 python run_clm.py \\
    --model_name_or_path gpt2 \\
    --dataset_name wikitext \\
    --dataset_config_name wikitext-2-raw-v1 \\
    --per_device_train_batch_size 4 \\
    --per_device_eval_batch_size 4 \\
    --do_train \\
    --do_eval \\
    --output_dir /tmp/test-clm \\
    --gaudi_config_name Habana/gpt2 \\
    --use_habana \\
    --use_lazy_mode \\
    --use_hpu_graphs_for_inference \\
    --throughput_warmup_steps 3`,wrap:!1}}),me=new c({props:{code:"bnVtYmVyX29mX2RldmljZXMlM0Q4JTIwJTVDJTBBUFRfSFBVX0xBWllfTU9ERSUzRDElMjBweXRob24lMjAuLiUyRmdhdWRpX3NwYXduLnB5JTIwLS11c2VfZGVlcHNwZWVkJTIwLS13b3JsZF9zaXplJTIwJTI0JTdCbnVtYmVyX29mX2RldmljZXMlN0QlMjAlNUMlMEFydW5fY2xtLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBncHQyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kYXRhc2V0X25hbWUlMjB3aWtpdGV4dCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9jb25maWdfbmFtZSUyMHdpa2l0ZXh0LTItcmF3LXYxJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlMjA0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUyMDQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX3RyYWluJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb19ldmFsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vdXRwdXRfZGlyJTIwJTJGdG1wJTJGdGVzdC1jbG0lMjAlNUMlMEElMjAlMjAlMjAlMjAtLWdhdWRpX2NvbmZpZ19uYW1lJTIwSGFiYW5hJTJGZ3B0MiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdXNlX2hhYmFuYSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdXNlX2xhenlfbW9kZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdXNlX2hwdV9ncmFwaHNfZm9yX2luZmVyZW5jZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZ3JhZGllbnRfY2hlY2twb2ludGluZyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdXNlX2NhY2hlJTIwRmFsc2UlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRocm91Z2hwdXRfd2FybXVwX3N0ZXBzJTIwMw==",highlighted:`number_of_devices=8 \\
PT_HPU_LAZY_MODE=1 python ../gaudi_spawn.py --use_deepspeed --world_size <span class="hljs-variable">\${number_of_devices}</span> \\
run_clm.py \\
    --model_name_or_path gpt2 \\
    --dataset_name wikitext \\
    --dataset_config_name wikitext-2-raw-v1 \\
    --per_device_train_batch_size 4 \\
    --per_device_eval_batch_size 4 \\
    --do_train \\
    --do_eval \\
    --output_dir /tmp/test-clm \\
    --gaudi_config_name Habana/gpt2 \\
    --use_habana \\
    --use_lazy_mode \\
    --use_hpu_graphs_for_inference \\
    --gradient_checkpointing \\
    --use_cache False \\
    --throughput_warmup_steps 3`,wrap:!1}}),oe=new g({props:{title:"Diffusion Workloads",local:"diffusion-workloads",headingTag:"h2"}}),re=new c({props:{code:"Y2QlMjB+JTJGb3B0aW11bS1oYWJhbmElMkZleGFtcGxlcyUyRnN0YWJsZS1kaWZmdXNpb24lMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:`<span class="hljs-built_in">cd</span> ~/optimum-habana/examples/stable-diffusion
pip install -r requirements.txt`,wrap:!1}}),de=new c({props:{code:"UFRfSFBVX0xBWllfTU9ERSUzRDElMjBweXRob24lMjB0ZXh0X3RvX2ltYWdlX2dlbmVyYXRpb24ucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1vZGVsX25hbWVfb3JfcGF0aCUyMENvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXByb21wdHMlMjAlMjJBbiUyMGltYWdlJTIwb2YlMjBhJTIwc3F1aXJyZWwlMjBpbiUyMFBpY2Fzc28lMjBzdHlsZSUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbnVtX2ltYWdlc19wZXJfcHJvbXB0JTIwMTAlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWJhdGNoX3NpemUlMjAxJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1pbWFnZV9zYXZlX2RpciUyMCUyRnRtcCUyRnN0YWJsZV9kaWZmdXNpb25faW1hZ2VzJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS11c2VfaGFiYW5hJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS11c2VfaHB1X2dyYXBocyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZ2F1ZGlfY29uZmlnJTIwSGFiYW5hJTJGc3RhYmxlLWRpZmZ1c2lvbiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tYmYxNg==",highlighted:`PT_HPU_LAZY_MODE=1 python text_to_image_generation.py \\
    --model_name_or_path CompVis/stable-diffusion-v1-4 \\
    --prompts <span class="hljs-string">&quot;An image of a squirrel in Picasso style&quot;</span> \\
    --num_images_per_prompt 10 \\
    --batch_size 1 \\
    --image_save_dir /tmp/stable_diffusion_images \\
    --use_habana \\
    --use_hpu_graphs \\
    --gaudi_config Habana/stable-diffusion \\
    --bf16`,wrap:!1}}),ye=new c({props:{code:"LSUyMGZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBERElNU2NoZWR1bGVyJTJDJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMEElMkIlMjBmcm9tJTIwb3B0aW11bS5oYWJhbmEuZGlmZnVzZXJzJTIwaW1wb3J0JTIwR2F1ZGlERElNU2NoZWR1bGVyJTJDJTIwR2F1ZGlTdGFibGVEaWZmdXNpb25QaXBlbGluZSUwQSUwQW1vZGVsX25hbWUlMjAlM0QlMjAlMjJDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS00JTIyJTBBJTBBLSUyMHNjaGVkdWxlciUyMCUzRCUyMERESU1TY2hlZHVsZXIuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX25hbWUlMkMlMjBzdWJmb2xkZXIlM0QlMjJzY2hlZHVsZXIlMjIpJTBBJTJCJTIwc2NoZWR1bGVyJTIwJTNEJTIwR2F1ZGlERElNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9uYW1lJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2NoZWR1bGVyJTIyKSUwQSUwQS0lMjBwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMkIlMjBwaXBlbGluZSUyMCUzRCUyMEdhdWRpU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX25hbWUlMkMlMEElMjAlMjAlMjAlMjBzY2hlZHVsZXIlM0RzY2hlZHVsZXIlMkMlMEElMkIlMjAlMjAlMjB1c2VfaGFiYW5hJTNEVHJ1ZSUyQyUwQSUyQiUyMCUyMCUyMHVzZV9ocHVfZ3JhcGhzJTNEVHJ1ZSUyQyUwQSUyQiUyMCUyMCUyMGdhdWRpX2NvbmZpZyUzRCUyMkhhYmFuYSUyRnN0YWJsZS1kaWZmdXNpb24lMjIlMkMlMEEpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMCU1QiUyMkFuJTIwaW1hZ2UlMjBvZiUyMGElMjBzcXVpcnJlbCUyMGluJTIwUGljYXNzbyUyMHN0eWxlJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ltYWdlc19wZXJfcHJvbXB0JTNEMTYlMkMlMEElMkIlMjAlMjAlMjBiYXRjaF9zaXplJTNENCUyQyUwQSk=",highlighted:`<span class="hljs-deletion">- from diffusers import DDIMScheduler, StableDiffusionPipeline</span>
<span class="hljs-addition">+ from optimum.habana.diffusers import GaudiDDIMScheduler, GaudiStableDiffusionPipeline</span>

model_name = &quot;CompVis/stable-diffusion-v1-4&quot;

<span class="hljs-deletion">- scheduler = DDIMScheduler.from_pretrained(model_name, subfolder=&quot;scheduler&quot;)</span>
<span class="hljs-addition">+ scheduler = GaudiDDIMScheduler.from_pretrained(model_name, subfolder=&quot;scheduler&quot;)</span>

<span class="hljs-deletion">- pipeline = StableDiffusionPipeline.from_pretrained(</span>
<span class="hljs-addition">+ pipeline = GaudiStableDiffusionPipeline.from_pretrained(</span>
    model_name,
    scheduler=scheduler,
<span class="hljs-addition">+   use_habana=True,</span>
<span class="hljs-addition">+   use_hpu_graphs=True,</span>
<span class="hljs-addition">+   gaudi_config=&quot;Habana/stable-diffusion&quot;,</span>
)

outputs = pipeline(
    [&quot;An image of a squirrel in Picasso style&quot;],
    num_images_per_prompt=16,
<span class="hljs-addition">+   batch_size=4,</span>
)`,wrap:!1}}),ce=new g({props:{title:"Ready-to-Use Examples",local:"ready-to-use-examples",headingTag:"h2"}}),ge=new cl({props:{source:"https://github.com/huggingface/optimum-habana/blob/main/docs/source/quickstart.mdx"}}),{c(){h=s("meta"),T=i(),U=s("p"),w=i(),o(J.$$.fragment),b=i(),o(y.$$.fragment),C=i(),_=s("p"),_.textContent=Gt,_e=i(),x=s("p"),x.innerHTML=jt,xe=i(),o(G.$$.fragment),Ge=i(),j=s("p"),j.innerHTML=Zt,je=i(),o(Z.$$.fragment),Ze=i(),v=s("p"),v.textContent=vt,ve=i(),o(X.$$.fragment),Xe=i(),o(I.$$.fragment),Be=i(),B=s("p"),B.textContent=Xt,We=i(),o(W.$$.fragment),Ve=i(),o(V.$$.fragment),Ae=i(),A=s("p"),A.innerHTML=Bt,Se=i(),o(S.$$.fragment),Re=i(),R=s("p"),R.innerHTML=Wt,ke=i(),k=s("p"),k.innerHTML=Vt,Ye=i(),o(Y.$$.fragment),Le=i(),L=s("p"),L.innerHTML=At,Ee=i(),E=s("ul"),E.innerHTML=St,Ne=i(),o(N.$$.fragment),He=i(),H=s("p"),H.textContent=Rt,Fe=i(),o(F.$$.fragment),Qe=i(),o($.$$.fragment),ze=i(),o(Q.$$.fragment),De=i(),z=s("p"),z.innerHTML=kt,Pe=i(),D=s("p"),D.textContent=Yt,qe=i(),o(P.$$.fragment),Oe=i(),q=s("p"),q.textContent=Lt,Ke=i(),o(O.$$.fragment),et=i(),o(K.$$.fragment),tt=i(),ee=s("p"),ee.textContent=Et,lt=i(),te=s("p"),te.innerHTML=Nt,at=i(),le=s("p"),le.textContent=Ht,it=i(),ae=s("p"),ae.textContent=Ft,nt=i(),o(ie.$$.fragment),st=i(),ne=s("p"),ne.textContent=Qt,pt=i(),o(se.$$.fragment),mt=i(),pe=s("p"),pe.textContent=zt,ot=i(),o(me.$$.fragment),ut=i(),o(oe.$$.fragment),ft=i(),ue=s("p"),ue.textContent=Dt,rt=i(),fe=s("p"),fe.textContent=Pt,Mt=i(),o(re.$$.fragment),dt=i(),Me=s("p"),Me.textContent=qt,ht=i(),o(de.$$.fragment),yt=i(),he=s("p"),he.textContent=Ot,Ut=i(),o(ye.$$.fragment),wt=i(),Ue=s("p"),Ue.innerHTML=Kt,ct=i(),we=s("p"),we.textContent=el,Tt=i(),o(ce.$$.fragment),Jt=i(),Te=s("p"),Te.innerHTML=tl,bt=i(),Je=s("p"),Je.textContent=ll,Ct=i(),be=s("ul"),be.innerHTML=al,gt=i(),Ce=s("p"),Ce.innerHTML=il,It=i(),o(ge.$$.fragment),$t=i(),$e=s("p"),this.h()},l(e){const t=dl("svelte-u9bgzb",document.head);h=p(t,"META",{name:!0,content:!0}),t.forEach(l),T=n(e),U=p(e,"P",{}),pl(U).forEach(l),w=n(e),u(J.$$.fragment,e),b=n(e),u(y.$$.fragment,e),C=n(e),_=p(e,"P",{"data-svelte-h":!0}),m(_)!=="svelte-1fmkdnw"&&(_.textContent=Gt),_e=n(e),x=p(e,"P",{"data-svelte-h":!0}),m(x)!=="svelte-1i3glzt"&&(x.innerHTML=jt),xe=n(e),u(G.$$.fragment,e),Ge=n(e),j=p(e,"P",{"data-svelte-h":!0}),m(j)!=="svelte-u6s0yg"&&(j.innerHTML=Zt),je=n(e),u(Z.$$.fragment,e),Ze=n(e),v=p(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-1qxk5ai"&&(v.textContent=vt),ve=n(e),u(X.$$.fragment,e),Xe=n(e),u(I.$$.fragment,e),Be=n(e),B=p(e,"P",{"data-svelte-h":!0}),m(B)!=="svelte-kspmr9"&&(B.textContent=Xt),We=n(e),u(W.$$.fragment,e),Ve=n(e),u(V.$$.fragment,e),Ae=n(e),A=p(e,"P",{"data-svelte-h":!0}),m(A)!=="svelte-x5zyir"&&(A.innerHTML=Bt),Se=n(e),u(S.$$.fragment,e),Re=n(e),R=p(e,"P",{"data-svelte-h":!0}),m(R)!=="svelte-l9hfrb"&&(R.innerHTML=Wt),ke=n(e),k=p(e,"P",{"data-svelte-h":!0}),m(k)!=="svelte-s3usfs"&&(k.innerHTML=Vt),Ye=n(e),u(Y.$$.fragment,e),Le=n(e),L=p(e,"P",{"data-svelte-h":!0}),m(L)!=="svelte-xnp9rz"&&(L.innerHTML=At),Ee=n(e),E=p(e,"UL",{"data-svelte-h":!0}),m(E)!=="svelte-k3o21o"&&(E.innerHTML=St),Ne=n(e),u(N.$$.fragment,e),He=n(e),H=p(e,"P",{"data-svelte-h":!0}),m(H)!=="svelte-168qvve"&&(H.textContent=Rt),Fe=n(e),u(F.$$.fragment,e),Qe=n(e),u($.$$.fragment,e),ze=n(e),u(Q.$$.fragment,e),De=n(e),z=p(e,"P",{"data-svelte-h":!0}),m(z)!=="svelte-10fpinn"&&(z.innerHTML=kt),Pe=n(e),D=p(e,"P",{"data-svelte-h":!0}),m(D)!=="svelte-bi4j8e"&&(D.textContent=Yt),qe=n(e),u(P.$$.fragment,e),Oe=n(e),q=p(e,"P",{"data-svelte-h":!0}),m(q)!=="svelte-1bt3yh4"&&(q.textContent=Lt),Ke=n(e),u(O.$$.fragment,e),et=n(e),u(K.$$.fragment,e),tt=n(e),ee=p(e,"P",{"data-svelte-h":!0}),m(ee)!=="svelte-1o571gu"&&(ee.textContent=Et),lt=n(e),te=p(e,"P",{"data-svelte-h":!0}),m(te)!=="svelte-41ad73"&&(te.innerHTML=Nt),at=n(e),le=p(e,"P",{"data-svelte-h":!0}),m(le)!=="svelte-bmhbdf"&&(le.textContent=Ht),it=n(e),ae=p(e,"P",{"data-svelte-h":!0}),m(ae)!=="svelte-1enbgba"&&(ae.textContent=Ft),nt=n(e),u(ie.$$.fragment,e),st=n(e),ne=p(e,"P",{"data-svelte-h":!0}),m(ne)!=="svelte-1ke0l3"&&(ne.textContent=Qt),pt=n(e),u(se.$$.fragment,e),mt=n(e),pe=p(e,"P",{"data-svelte-h":!0}),m(pe)!=="svelte-1dh6bbj"&&(pe.textContent=zt),ot=n(e),u(me.$$.fragment,e),ut=n(e),u(oe.$$.fragment,e),ft=n(e),ue=p(e,"P",{"data-svelte-h":!0}),m(ue)!=="svelte-1985s4l"&&(ue.textContent=Dt),rt=n(e),fe=p(e,"P",{"data-svelte-h":!0}),m(fe)!=="svelte-ygfcsn"&&(fe.textContent=Pt),Mt=n(e),u(re.$$.fragment,e),dt=n(e),Me=p(e,"P",{"data-svelte-h":!0}),m(Me)!=="svelte-vzrlr2"&&(Me.textContent=qt),ht=n(e),u(de.$$.fragment,e),yt=n(e),he=p(e,"P",{"data-svelte-h":!0}),m(he)!=="svelte-1sbfbaa"&&(he.textContent=Ot),Ut=n(e),u(ye.$$.fragment,e),wt=n(e),Ue=p(e,"P",{"data-svelte-h":!0}),m(Ue)!=="svelte-137fgro"&&(Ue.innerHTML=Kt),ct=n(e),we=p(e,"P",{"data-svelte-h":!0}),m(we)!=="svelte-h7h6u7"&&(we.textContent=el),Tt=n(e),u(ce.$$.fragment,e),Jt=n(e),Te=p(e,"P",{"data-svelte-h":!0}),m(Te)!=="svelte-9puxqn"&&(Te.innerHTML=tl),bt=n(e),Je=p(e,"P",{"data-svelte-h":!0}),m(Je)!=="svelte-iafmur"&&(Je.textContent=ll),Ct=n(e),be=p(e,"UL",{"data-svelte-h":!0}),m(be)!=="svelte-qt9s67"&&(be.innerHTML=al),gt=n(e),Ce=p(e,"P",{"data-svelte-h":!0}),m(Ce)!=="svelte-1ot82ge"&&(Ce.innerHTML=il),It=n(e),u(ge.$$.fragment,e),$t=n(e),$e=p(e,"P",{}),pl($e).forEach(l),this.h()},h(){xt(h,"name","hf:doc:metadata"),xt(h,"content",Cl)},m(e,t){hl(document.head,h),a(e,T,t),a(e,U,t),a(e,w,t),f(J,e,t),a(e,b,t),f(y,e,t),a(e,C,t),a(e,_,t),a(e,_e,t),a(e,x,t),a(e,xe,t),f(G,e,t),a(e,Ge,t),a(e,j,t),a(e,je,t),f(Z,e,t),a(e,Ze,t),a(e,v,t),a(e,ve,t),f(X,e,t),a(e,Xe,t),f(I,e,t),a(e,Be,t),a(e,B,t),a(e,We,t),f(W,e,t),a(e,Ve,t),f(V,e,t),a(e,Ae,t),a(e,A,t),a(e,Se,t),f(S,e,t),a(e,Re,t),a(e,R,t),a(e,ke,t),a(e,k,t),a(e,Ye,t),f(Y,e,t),a(e,Le,t),a(e,L,t),a(e,Ee,t),a(e,E,t),a(e,Ne,t),f(N,e,t),a(e,He,t),a(e,H,t),a(e,Fe,t),f(F,e,t),a(e,Qe,t),f($,e,t),a(e,ze,t),f(Q,e,t),a(e,De,t),a(e,z,t),a(e,Pe,t),a(e,D,t),a(e,qe,t),f(P,e,t),a(e,Oe,t),a(e,q,t),a(e,Ke,t),f(O,e,t),a(e,et,t),f(K,e,t),a(e,tt,t),a(e,ee,t),a(e,lt,t),a(e,te,t),a(e,at,t),a(e,le,t),a(e,it,t),a(e,ae,t),a(e,nt,t),f(ie,e,t),a(e,st,t),a(e,ne,t),a(e,pt,t),f(se,e,t),a(e,mt,t),a(e,pe,t),a(e,ot,t),f(me,e,t),a(e,ut,t),f(oe,e,t),a(e,ft,t),a(e,ue,t),a(e,rt,t),a(e,fe,t),a(e,Mt,t),f(re,e,t),a(e,dt,t),a(e,Me,t),a(e,ht,t),f(de,e,t),a(e,yt,t),a(e,he,t),a(e,Ut,t),f(ye,e,t),a(e,wt,t),a(e,Ue,t),a(e,ct,t),a(e,we,t),a(e,Tt,t),f(ce,e,t),a(e,Jt,t),a(e,Te,t),a(e,bt,t),a(e,Je,t),a(e,Ct,t),a(e,be,t),a(e,gt,t),a(e,Ce,t),a(e,It,t),f(ge,e,t),a(e,$t,t),a(e,$e,t),_t=!0},p(e,[t]){const nl={};t&2&&(nl.$$scope={dirty:t,ctx:e}),I.$set(nl);const sl={};t&2&&(sl.$$scope={dirty:t,ctx:e}),$.$set(sl)},i(e){_t||(r(J.$$.fragment,e),r(y.$$.fragment,e),r(G.$$.fragment,e),r(Z.$$.fragment,e),r(X.$$.fragment,e),r(I.$$.fragment,e),r(W.$$.fragment,e),r(V.$$.fragment,e),r(S.$$.fragment,e),r(Y.$$.fragment,e),r(N.$$.fragment,e),r(F.$$.fragment,e),r($.$$.fragment,e),r(Q.$$.fragment,e),r(P.$$.fragment,e),r(O.$$.fragment,e),r(K.$$.fragment,e),r(ie.$$.fragment,e),r(se.$$.fragment,e),r(me.$$.fragment,e),r(oe.$$.fragment,e),r(re.$$.fragment,e),r(de.$$.fragment,e),r(ye.$$.fragment,e),r(ce.$$.fragment,e),r(ge.$$.fragment,e),_t=!0)},o(e){M(J.$$.fragment,e),M(y.$$.fragment,e),M(G.$$.fragment,e),M(Z.$$.fragment,e),M(X.$$.fragment,e),M(I.$$.fragment,e),M(W.$$.fragment,e),M(V.$$.fragment,e),M(S.$$.fragment,e),M(Y.$$.fragment,e),M(N.$$.fragment,e),M(F.$$.fragment,e),M($.$$.fragment,e),M(Q.$$.fragment,e),M(P.$$.fragment,e),M(O.$$.fragment,e),M(K.$$.fragment,e),M(ie.$$.fragment,e),M(se.$$.fragment,e),M(me.$$.fragment,e),M(oe.$$.fragment,e),M(re.$$.fragment,e),M(de.$$.fragment,e),M(ye.$$.fragment,e),M(ce.$$.fragment,e),M(ge.$$.fragment,e),_t=!1},d(e){e&&(l(T),l(U),l(w),l(b),l(C),l(_),l(_e),l(x),l(xe),l(Ge),l(j),l(je),l(Ze),l(v),l(ve),l(Xe),l(Be),l(B),l(We),l(Ve),l(Ae),l(A),l(Se),l(Re),l(R),l(ke),l(k),l(Ye),l(Le),l(L),l(Ee),l(E),l(Ne),l(He),l(H),l(Fe),l(Qe),l(ze),l(De),l(z),l(Pe),l(D),l(qe),l(Oe),l(q),l(Ke),l(et),l(tt),l(ee),l(lt),l(te),l(at),l(le),l(it),l(ae),l(nt),l(st),l(ne),l(pt),l(mt),l(pe),l(ot),l(ut),l(ft),l(ue),l(rt),l(fe),l(Mt),l(dt),l(Me),l(ht),l(yt),l(he),l(Ut),l(wt),l(Ue),l(ct),l(we),l(Tt),l(Jt),l(Te),l(bt),l(Je),l(Ct),l(be),l(gt),l(Ce),l(It),l($t),l($e)),l(h),d(J,e),d(y,e),d(G,e),d(Z,e),d(X,e),d(I,e),d(W,e),d(V,e),d(S,e),d(Y,e),d(N,e),d(F,e),d($,e),d(Q,e),d(P,e),d(O,e),d(K,e),d(ie,e),d(se,e),d(me,e),d(oe,e),d(re,e),d(de,e),d(ye,e),d(ce,e),d(ge,e)}}}const Cl='{"title":"Quickstart","local":"quickstart","sections":[{"title":"Accessing Intel Gaudi AI Accelerator","local":"accessing-intel-gaudi-ai-accelerator","sections":[],"depth":2},{"title":"Docker Setup","local":"docker-setup","sections":[],"depth":2},{"title":"Optimum for Intel Gaudi Setup","local":"optimum-for-intel-gaudi-setup","sections":[],"depth":2},{"title":"Single Device Inference","local":"single-device-inference","sections":[],"depth":2},{"title":"Multi-Device Inference","local":"multi-device-inference","sections":[],"depth":2},{"title":"Training on Gaudi","local":"training-on-gaudi","sections":[],"depth":2},{"title":"Diffusion Workloads","local":"diffusion-workloads","sections":[],"depth":2},{"title":"Ready-to-Use Examples","local":"ready-to-use-examples","sections":[],"depth":2}],"depth":1}';function gl(Ie){return fl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class jl extends rl{constructor(h){super(),Ml(this,h,gl,bl,ul,{})}}export{jl as component};
