Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Topluluk boru hatları ve bileşenleri","local":"community-pipelines-and-components","sections":[{"title":"Bir topluluk hattı yükleme","local":"loading-a-community-pipeline","sections":[],"depth":2},{"title":"Topluluk bileşenleri","local":"community-components","sections":[],"depth":2},{"title":"Sonraki adımlar","local":"next-steps","sections":[],"depth":2}],"depth":1}"/> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/start.vZc-dOUR.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/Bafuik5c.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/Bupkjr9f.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/app.B6c3Ml05.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/CyvZ3FS5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/l0QnnOED.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DnVIJfC5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/0.BQlx092V.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/CoSrdQax.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/385.CEuTCgse.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/B4AMoTAu.js" rel="modulepreload"> | |
| <!--1nactrq--><meta name="hf:doc:metadata" content="{"title":"Community pipelines and components","local":"community-pipelines-and-components","sections":[{"title":"Loading a community pipeline","local":"loading-a-community-pipeline","sections":[],"depth":2},{"title":"Community components","local":"community-components","sections":[],"depth":2},{"title":"Next steps","local":"next-steps","sections":[],"depth":2}],"depth":1}"/><!----> | |
| <link href="/docs/diffusers/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"><div dir="ltr" class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span dir="auto">Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="community-pipelines-and-components" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#community-pipelines-and-components"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Topluluk boru hatları ve bileşenleri<!----></span></h1><!--]--><!----> <p>Topluluk boru hatları, orijinal makale uygulamasından farklı olan <a href="/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a> sınıflarıdır. Ek işlevsellik sağlarlar veya orijinal boru hattı uygulamasını genişletirler.</p> <blockquote class="tip"><p>Çıkarım ve eğitim örnekleriyle nasıl kullanılacaklarını gösteren topluluk pipeline'larını <a href="https://github.com/huggingface/diffusers/tree/main/examples/community" rel="nofollow">diffusers/examples/community</a> dizininde inceleyin.</p></blockquote> <p>Topluluk pipeline'ları ya Hub'da ya da Diffusers'ın GitHub deposunda saklanır. Hub pipeline'ları tamamen özelleştirilebilir (zamanlayıcı, modeller, pipeline kodu vb.)ken GitHub pipeline'ları yalnızca özel pipeline koduyla sınırlıdır. İki pipeline türünü aşağıdaki tabloda karşılaştırın.</p> <table><thead><tr><th></th><th>GitHub</th><th>Hub</th></tr></thead><tbody><tr><td>Kullanım</td><td><code>custom_pipeline="<filename_without_.py>"</code></td><td>Hub depo kimliği veya <code>_class_name</code> özel koda işaret ettiğinde <code>trust_remote_code=True</code></td></tr><tr><td>İnceleme süreci</td><td>GitHub'da bir Pull Request açın ve birleştirilmeden önce Diffusers ekibinden bir inceleme sürecinden geçirin. Bu seçenek daha yavaştır.</td><td>Bir Hub deposuna inceleme olmadan doğrudan yükleyin. Bu, en hızlı seçenektir.</td></tr><tr><td>Görünürlük</td><td>Resmî Diffusers deposu ve belgelerinde yer alır.</td><td>Hub profilinizde yer alır ve görünürlük kazanmak için kendi kullanımınıza ve tanıtımınıza bağlıdır.</td></tr></tbody></table> <!--[1--><h2 class="relative group"><a id="loading-a-community-pipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#loading-a-community-pipeline"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Bir topluluk hattı yükleme<!----></span></h2><!--]--><!----> <p><code>custom_pipeline</code> parametresini <a href="/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained">from_pretrained()</a> fonksiyonuna ileterek topluluk kaynaklı her iki türden de pipeline yükleyebilirsiniz.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, | |
| custom_pipeline=<span class="hljs-string">"pipeline_stable_diffusion_3_instruct_pix2pix"</span>, | |
| dtype=torch.float16, | |
| device_map=<span class="hljs-string">"cuda"</span> <span class="hljs-comment"># or "mps", "xpu", "cpu"</span> | |
| )<!----></pre></div><!----> <p>Belirli bir sürümden (örneğin <code>v0.30.0</code> veya <code>main</code>) topluluk hattı yüklemek için <a href="/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained">from_pretrained()</a> fonksiyonuna <code>custom_revision</code> argümanını ekleyin. Varsayılan olarak, topluluk hatları Diffusers'ın en son kararlı sürümünden yüklenir.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, | |
| custom_pipeline=<span class="hljs-string">"pipeline_stable_diffusion_3_instruct_pix2pix"</span>, | |
| custom_revision=<span class="hljs-string">"main"</span>, | |
| dtype=torch.float16, | |
| device_map=<span class="hljs-string">"cuda"</span> <span class="hljs-comment"># or "mps", "xpu", "cpu"</span> | |
| )<!----></pre></div><!----> <blockquote class="warning"><p>Hugging Face Hub dosyaları <a href="https://huggingface.co/docs/hub/security-malware" rel="nofollow">tarama</a> yaparken, yine de Hub pipeline kodunu incelemeli ve güvenli olduğundan emin olmalısınız.</p></blockquote> <p>Bir topluluk hattını yüklemenin birkaç yolu vardır.</p> <ul><li><p><code>custom_pipeline</code> parametresine yerel bir topluluk hattını yüklemek için bir yol iletin. Dizin, hat sınıfını içeren bir <code>pipeline.py</code> dosyası içermelidir.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-3-medium-diffusers"</span>, | |
| custom_pipeline=<span class="hljs-string">"path/to/pipeline_directory"</span>, | |
| trust_remote_code=<span class="hljs-literal">True</span>, | |
| dtype=torch.float16, | |
| device_map=<span class="hljs-string">"cuda"</span> <span class="hljs-comment"># or "mps", "xpu", "cpu"</span> | |
| )<!----></pre></div><!----></li> <li><p><code>custom_pipeline</code> argümanı, ek bellek kullanmadan <a href="./loading#reusing-models-in-multiple-pipelines">boru hatlarını yeniden kullanmak</a> için faydalı olan <a href="/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline.from_pipe">from_pipe()</a> tarafından da desteklenir. Bu, bellek kullanımını yalnızca yüklenen en büyük boru hattıyla sınırlar.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-py "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| pipeline_sd = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"emilianJR/CyberRealistic_V3"</span>, dtype=torch.float16, device_map=<span class="hljs-string">"cuda"</span> <span class="hljs-comment"># or "mps", "xpu", "cpu"</span> | |
| ) | |
| pipeline_lpw = DiffusionPipeline.from_pipe( | |
| pipeline_sd, custom_pipeline=<span class="hljs-string">"lpw_stable_diffusion"</span> | |
| )<!----></pre></div><!----> <p><a href="/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline.from_pipe">from_pipe()</a> yöntemi, topluluk boru hatlarını yüklemek için özellikle faydalıdır çünkü bunların çoğunun önceden eğitilmiş ağırlıkları yoktur. Topluluk boru hatları genellikle mevcut bir boru hattının üzerine bir özellik ekler.</p></li></ul> <!--[1--><h2 class="relative group"><a id="community-components" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#community-components"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Topluluk bileşenleri<!----></span></h2><!--]--><!----> <p>Community components, Diffusers tarafından desteklenmeyen özel transformer, UNet, VAE ve scheduler'larla pipeline oluşturmanızı sağlar. Bu bileşenlerin kendi Python modüllerine ihtiyaç duyar.</p> <p>Bu bölüm, kullanıcıların topluluk bileşenlerini kullanarak bir topluluk hattı oluşturmayı nasıl yapabileceklerini, örnek olarak <a href="https://huggingface.co/showlab/show-1-base" rel="nofollow">showlab/show-1-base</a> modelini kullanarak göstermektedir.</p> <ol><li>Gerekli bileşenleri, zamanlayıcıyı ve görüntü işleyiciyi yükleyin. Metin kodlayıcı genellikle <a href="https://huggingface.co/docs/transformers/index" rel="nofollow">Transformers</a> kütüphanesinden içe aktarılır.</li></ol> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> T5Tokenizer, T5EncoderModel, CLIPImageProcessor | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DPMSolverMultistepScheduler | |
| pipeline_id = <span class="hljs-string">"showlab/show-1-base"</span> | |
| tokenizer = T5Tokenizer.from_pretrained(pipeline_id, subfolder=<span class="hljs-string">"tokenizer"</span>) | |
| text_encoder = T5EncoderModel.from_pretrained(pipeline_id, subfolder=<span class="hljs-string">"text_encoder"</span>) | |
| scheduler = DPMSolverMultistepScheduler.from_pretrained(pipeline_id, subfolder=<span class="hljs-string">"scheduler"</span>) | |
| feature_extractor = CLIPImageProcessor.from_pretrained(pipeline_id, subfolder=<span class="hljs-string">"feature_extractor"</span>)<!----></pre></div><!----> <blockquote class="warning"><p>2. ve 3. adımlarda, özel <a href="https://github.com/showlab/Show-1/blob/main/showone/models/unet_3d_condition.py" rel="nofollow">UNet</a> ve <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py" rel="nofollow">pipeline</a> uygulamasının, bu örneğin çalışabilmesi için dosyalarında gösterilen biçimle eşleşmesi gerekir.</p></blockquote> <ol start="2"><li><a href="https://github.com/showlab/Show-1/blob/main/showone/models/unet_3d_condition.py" rel="nofollow">Özel bir UNet</a> yükleyin; bu, zaten <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py" rel="nofollow">showone_unet_3d_condition.py</a> içinde uygulanmıştır. <a href="/docs/diffusers/main/tr/api/models/unet3d-cond#diffusers.UNet3DConditionModel">UNet3DConditionModel</a> sınıf adı, Diffusers'ta zaten var olduğu için <a href="/docs/diffusers/main/tr/api/models/unet3d-cond#diffusers.UNet3DConditionModel">UNet3DConditionModel</a> yerine özel uygulama olan <code>ShowOneUNet3DConditionModel</code> olarak yeniden adlandırılmıştır. <code>ShowOneUNet3DConditionModel</code> sınıfı için gerekli tüm bileşenler <code>showone_unet_3d_condition.py</code> dosyasında yer almalıdır.</li></ol> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> showone_unet_3d_condition <span class="hljs-keyword">import</span> ShowOneUNet3DConditionModel | |
| unet = ShowOneUNet3DConditionModel.from_pretrained(pipeline_id, subfolder=<span class="hljs-string">"unet"</span>)<!----></pre></div><!----> <ol start="3"><li>Özel pipeline kodunu yükleyin (zaten <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/pipeline_t2v_base_pixel.py" rel="nofollow">pipeline_t2v_base_pixel.py</a> içinde uygulandı). Bu betik, metinden video üretmek için özel bir <code>TextToVideoIFPipeline</code> sınıfı içerir. Özel UNet gibi, <code>TextToVideoIFPipeline</code> için gerekli olan tüm kod <code>pipeline_t2v_base_pixel.py</code> dosyasına yerleştirilmelidir.</li></ol> <p><code>TextToVideoIFPipeline</code>'i <code>ShowOneUNet3DConditionModel</code> ile başlatın.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> pipeline_t2v_base_pixel <span class="hljs-keyword">import</span> TextToVideoIFPipeline | |
| pipeline = TextToVideoIFPipeline( | |
| unet=unet, | |
| text_encoder=text_encoder, | |
| tokenizer=tokenizer, | |
| scheduler=scheduler, | |
| feature_extractor=feature_extractor, | |
| ) | |
| pipeline = pipeline.to(<span class="hljs-string">"cuda"</span>) <span class="hljs-comment"># or "mps", "xpu", "cpu"</span><!----></pre></div><!----> <ol start="4"><li>Pipeline'ı toplulukla paylaşmak için Hub'a gönderin.</li></ol> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->pipeline.push_to_hub(<span class="hljs-string">"custom-t2v-pipeline"</span>)<!----></pre></div><!----> <p>Pipeline başarıyla itildikten sonra aşağıdaki değişiklikleri yapın.</p> <ul><li><a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/model_index.json#L2" rel="nofollow">model_index.json</a> dosyasındaki <code>_class_name</code> özniteliğini <code>["pipeline_t2v_base_pixel", "TextToVideoIFPipeline"]</code> olarak değiştirin.</li> <li><code>showone_unet_3d_condition.py</code> dosyasını <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py" rel="nofollow">unet</a> alt klasörüne yükleyin.</li> <li><code>pipeline_t2v_base_pixel.py</code> dosyasını <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/tree/main" rel="nofollow">repository</a> hattına yükleyin.</li></ul> <p>Çıkarım (inference) çalıştırmak için, arka plandaki tüm “sihirli” işlemleri yönetmek üzere pipeline'ı başlatırken <code>trust_remote_code</code> argümanını ekleyin.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"<change-username>/<change-id>"</span>, trust_remote_code=<span class="hljs-literal">True</span>, dtype=torch.float16 | |
| )<!----></pre></div><!----> <blockquote class="warning"><p><code>trust_remote_code=True</code> ile ek bir önlem olarak, kodun yeni kötü amaçlı kodlarla güncellenmediğinden emin olmak için <a href="/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained">from_pretrained()</a> içindeki <code>revision</code> argümanına bir commit hash'i iletin (model sahiplerine tamamen güvenmiyorsanız).</p></blockquote> <!--[1--><h2 class="relative group"><a id="next-steps" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#next-steps"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Sonraki adımlar<!----></span></h2><!--]--><!----> <ul><li>Herkesin işlerini yavaşlamadan kolayca paylaşmasına yardımcı olmak için topluluk boru hatlarını neden eklediğimiz hakkında daha fazla bağlam için <a href="https://github.com/huggingface/diffusers/issues/841" rel="nofollow">#841</a> numaralı soruna göz atın.</li> <li>Ek bir topluluk hattı örneği olarak <code>trust_remote_code</code> özelliğini de kullanan <a href="https://huggingface.co/stabilityai/japanese-stable-diffusion-xl/" rel="nofollow">stabilityai/japanese-stable-diffusion-xl</a> deposuna göz atın.</li></ul> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/custom_pipeline_overview.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]--> | |
| <script> | |
| { | |
| __sveltekit_1rjuniz = { | |
| base: "/docs/diffusers/main/en", | |
| assets: "/docs/diffusers/main/en" | |
| }; | |
| const element = document.currentScript.parentElement; | |
| Promise.all([ | |
| import("/docs/diffusers/main/en/_app/immutable/entry/start.vZc-dOUR.js"), | |
| import("/docs/diffusers/main/en/_app/immutable/entry/app.B6c3Ml05.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 385], | |
| data: [null,null], | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 34.7 kB
- Xet hash:
- e0f7e4178ea233e0d1d3abad92134611758729af6a510cd4344d6015d85d2bbb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.