Spaces:
				
			
			
	
			
			
		Running
		
			on 
			
			Zero
	
	
	
			
			
	
	
	
	
		
		
		Running
		
			on 
			
			Zero
	| <!--Copyright 2024 The HuggingFace Team. All rights reserved. | |
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | |
| the License. You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | |
| an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | |
| specific language governing permissions and limitations under the License. | |
| --> | |
| # ์ถ๋ก ์ ์ํ OpenVINO ์ฌ์ฉ ๋ฐฉ๋ฒ | |
| ๐ค [Optimum](https://github.com/huggingface/optimum-intel)์ OpenVINO์ ํธํ๋๋ Stable Diffusion ํ์ดํ๋ผ์ธ์ ์ ๊ณตํฉ๋๋ค. | |
| ์ด์  ๋ค์ํ Intel ํ๋ก์ธ์์์ OpenVINO Runtime์ผ๋ก ์ฝ๊ฒ ์ถ๋ก ์ ์ํํ ์ ์์ต๋๋ค. ([์ฌ๊ธฐ](https://docs.openvino.ai/latest/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html)์ ์ง์๋๋ ์  ๊ธฐ๊ธฐ ๋ชฉ๋ก์ ํ์ธํ์ธ์). | |
| ## ์ค์น | |
| ๋ค์ ๋ช ๋ น์ด๋ก ๐ค Optimum์ ์ค์นํฉ๋๋ค: | |
| ```sh | |
| pip install optimum["openvino"] | |
| ``` | |
| ## Stable Diffusion ์ถ๋ก | |
| OpenVINO ๋ชจ๋ธ์ ๋ถ๋ฌ์ค๊ณ OpenVINO ๋ฐํ์์ผ๋ก ์ถ๋ก ์ ์คํํ๋ ค๋ฉด `StableDiffusionPipeline`์ `OVStableDiffusionPipeline`์ผ๋ก ๊ต์ฒดํด์ผ ํฉ๋๋ค. PyTorch ๋ชจ๋ธ์ ๋ถ๋ฌ์ค๊ณ ์ฆ์ OpenVINO ํ์์ผ๋ก ๋ณํํ๋ ค๋ ๊ฒฝ์ฐ `export=True`๋ก ์ค์ ํฉ๋๋ค. | |
| ```python | |
| from optimum.intel.openvino import OVStableDiffusionPipeline | |
| model_id = "stable-diffusion-v1-5/stable-diffusion-v1-5" | |
| pipe = OVStableDiffusionPipeline.from_pretrained(model_id, export=True) | |
| prompt = "a photo of an astronaut riding a horse on mars" | |
| images = pipe(prompt).images[0] | |
| ``` | |
| [Optimum ๋ฌธ์](https://huggingface.co/docs/optimum/intel/inference#export-and-inference-of-stable-diffusion-models)์์ (์ ์  reshaping๊ณผ ๋ชจ๋ธ ์ปดํ์ผ ๋ฑ์) ๋ ๋ง์ ์์๋ค์ ์ฐพ์ ์ ์์ต๋๋ค. | |