Buckets:
| # OpenVINO | |
| 🤗 [Optimum](https://github.com/huggingface/optimum-intel), çeşitli Intel işlemcilerde çıkarım (inference) yapmak için OpenVINO ile uyumlu Stable Diffusion hatları (pipelines) sağlar (desteklenen cihazların [tam listesine](https://docs.openvino.ai/latest/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) bakın). | |
| 🤗 Optimum Intel'i `--upgrade-strategy eager` seçeneğiyle kurmanız gerekir; bu, [`optimum-intel`](https://github.com/huggingface/optimum-intel)'in en güncel sürümü kullandığından emin olmak içindir: | |
| ```bash | |
| pip install --upgrade-strategy eager optimum["openvino"] | |
| ``` | |
| Bu kılavuz, Stable Diffusion ve Stable Diffusion XL (SDXL) hatlarını OpenVINO ile nasıl kullanacağınızı gösterecektir. | |
| ## Stable Diffusion | |
| Yükleme ve çıkarım çalıştırmak için `OVStableDiffusionPipeline` kullanın. Bir PyTorch modelini yükleyip OpenVINO biçimine anında dönüştürmek istiyorsanız `export=True` olarak ayarlayın: | |
| ```python | |
| from optimum.intel import OVStableDiffusionPipeline | |
| model_id = "stable-diffusion-v1-5/stable-diffusion-v1-5" | |
| pipeline = OVStableDiffusionPipeline.from_pretrained(model_id, export=True) | |
| prompt = "sailing ship in storm by Rembrandt" | |
| image = pipeline(prompt).images[0] | |
| # Don't forget to save the exported model | |
| pipeline.save_pretrained("openvino-sd-v1-5") | |
| ``` | |
| Çıkarımı (inference) daha da hızlandırmak için modeli statik olarak yeniden şekillendirin. Çıktı yüksekliği veya genişliği gibi parametrelerde değişiklik yaparsanız, modelinizi tekrar statik olarak yeniden şekillendirmeniz gerekir. | |
| ```python | |
| # Define the shapes related to the inputs and desired outputs | |
| batch_size, num_images, height, width = 1, 1, 512, 512 | |
| # Statically reshape the model | |
| pipeline.reshape(batch_size, height, width, num_images) | |
| # Compile the model before inference | |
| pipeline.compile() | |
| image = pipeline( | |
| prompt, | |
| height=height, | |
| width=width, | |
| num_images_per_prompt=num_images, | |
| ).images[0] | |
| ``` | |
| Daha fazla örneği 🤗 Optimum [belgelerinde](https://huggingface.co/docs/optimum/intel/inference#stable-diffusion) bulabilirsiniz ve Stable Diffusion, metinden görüntüye, görüntüden görüntüye ve inpainting işlemleri için desteklenmektedir. | |
| ## Stable Diffusion XL | |
| SDXL ile yüklemek ve çıkarım yapmak için `OVStableDiffusionXLPipeline` kullanın: | |
| ```python | |
| from optimum.intel import OVStableDiffusionXLPipeline | |
| model_id = "stabilityai/stable-diffusion-xl-base-1.0" | |
| pipeline = OVStableDiffusionXLPipeline.from_pretrained(model_id) | |
| prompt = "sailing ship in storm by Rembrandt" | |
| image = pipeline(prompt).images[0] | |
| ``` | |
| Çıkarımı daha da hızlandırmak için, Stable Diffusion bölümünde gösterildiği gibi modeli [statik olarak yeniden şekillendirin](#stable-diffusion). | |
| Daha fazla örneği 🤗 Optimum [belgelerinde](https://huggingface.co/docs/optimum/intel/inference#stable-diffusion-xl) bulabilirsiniz ve OpenVINO'da SDXL çalıştırma, metinden görüntüye ve görüntüden görüntüye işlemler için desteklenmektedir. | |
Xet Storage Details
- Size:
- 3.07 kB
- Xet hash:
- 1ae78ad53231bf0559580b8ea19745ad4af21599dfc5dbf6b8b55a0613754911
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.