Buckets:
| # Otomatik dokümantasyon dizgesi ve parametre şablonları | |
| Her [ModularPipelineBlocks](/docs/diffusers/main/tr/api/modular_diffusers/pipeline_blocks#diffusers.ModularPipelineBlocks) öğesi, `description`, `inputs`, `intermediate_outputs`, `expected_components` ve `expected_configs` alanlarından otomatik olarak oluşturulan bir `doc` özelliğine sahiptir. Otomatik docstring sistemi, docstring'lerin bloğun gerçek arayüzüyle senkron kalmasını sağlar. Parametre şablonları, birçok pipeline'da yer alan parametreler için standartlaştırılmış açıklamalar sunar. | |
| ## Otomatik dokümantasyon dizgesi | |
| Modüler pipeline blokları birleştirilebilir — bunları iç içe yerleştirebilir, diziler halinde zincirleyebilir ve serbestçe yeniden düzenleyebilirsiniz. Dokümantasyon dizgileri (docstring) aynı kalıbı izler. Bir [SequentialPipelineBlocks](/docs/diffusers/main/tr/api/modular_diffusers/pipeline_blocks#diffusers.SequentialPipelineBlocks) alt bloklarından gelen girdileri ve çıktıları topladığında, dokümantasyon manuel yeniden yazımlar gerektirmeden otomatik olarak güncellenmelidir. | |
| `# auto_docstring` işareti, bloğun özelliklerinden dokümantasyon dizeleri (docstring) üretir. Sınıfın otomatik dokümantasyon dizesi üretilmesini belirtmek için sınıf tanımının üzerine ekleyin. | |
| ```py | |
| # auto_docstring | |
| class FluxTextEncoderStep(SequentialPipelineBlocks): | |
| ... | |
| ``` | |
| Belgeleri oluşturmak ve eklemek için aşağıdaki komutu çalıştırın. | |
| ```bash | |
| python utils/modular_auto_docstring.py --fix_and_overwrite | |
| ``` | |
| Yardımcı, bloğun `doc` özelliğini okur ve onu sınıf docstring'i olarak ekler. | |
| ```py | |
| # auto_docstring | |
| class FluxTextEncoderStep(SequentialPipelineBlocks): | |
| """ | |
| Text input processing step that standardizes text embeddings for the pipeline. | |
| Inputs: | |
| prompt_embeds (`torch.Tensor`) *required*: | |
| text embeddings used to guide the image generation. | |
| ... | |
| Outputs: | |
| prompt_embeds (`torch.Tensor`): | |
| text embeddings used to guide the image generation. | |
| ... | |
| """ | |
| ``` | |
| Ayrıca üzerine yazmadan da kontrol edebilir veya belirli bir dosya veya dizini hedefleyebilirsiniz. | |
| ```bash | |
| # Check that all marked classes have up-to-date docstrings | |
| python utils/modular_auto_docstring.py | |
| # Check a specific file or directory | |
| python utils/modular_auto_docstring.py src/diffusers/modular_pipelines/flux/ | |
| ``` | |
| İşaretlenen sınıflardan herhangi birinde docstring eksikse, kontrol başarısız olur ve güncellenmesi gereken sınıfları listeler. | |
| ``` | |
| Found the following # auto_docstring markers that need docstrings: | |
| - src/diffusers/modular_pipelines/flux/encoders.py: FluxTextEncoderStep at line 42 | |
| Run `python utils/modular_auto_docstring.py --fix_and_overwrite` to fix them. | |
| ``` | |
| ## Parametre şablonları | |
| `InputParam` ve `OutputParam`, bir bloğun girdilerini ve çıktıları tanımlar. Bunları doğrudan oluşturabilir veya `prompt`, `num_inference_steps` veya `latents` gibi yaygın parametrelerin standart tanımları için `.template()` kullanabilirsiniz. | |
| ### InputParam | |
| `InputParam`, bir bloğa ait tek bir girdiyi tanımlar. | |
| | Alan | Tür | Açıklama | | |
| |---|---|---| | |
| | `name` | `str` | Parametrenin adı | | |
| | `type_hint` | `Any` | Tip anotasyonu (ör. `str`, `torch.Tensor`) | | |
| | `default` | `Any` | Varsayılan değer (ayarlanmazsa, parametrenin varsayılanı yoktur) | | |
| | `required` | `bool` | Parametrenin zorunlu olup olmadığı | | |
| | `description` | `str` | İnsan okunabilir açıklama | | |
| | `kwargs_type` | `str` | İlgili parametreler için grup adı (ör. `"denoiser_input_fields"`) | | |
| | `metadata` | `dict` | İsteğe bağlı ek bilgiler | | |
| #### InputParam'ı doğrudan oluşturma | |
| ```py | |
| from diffusers.modular_pipelines import InputParam | |
| InputParam( | |
| name="guidance_scale", | |
| type_hint=float, | |
| default=7.5, | |
| description="Scale for classifier-free guidance.", | |
| ) | |
| ``` | |
| #### Şablon kullanma | |
| ```py | |
| InputParam.template("prompt") | |
| # Equivalent to: | |
| # InputParam(name="prompt", type_hint=str, required=True, | |
| # description="The prompt or prompts to guide image generation.") | |
| ``` | |
| Şablonlar `name`, `type_hint`, `default`, `required` ve `description` alanlarını otomatik olarak ayarlar. Herhangi bir alanı geçersiz kılabilir veya `note` parametresiyle bağlam ekleyebilirsiniz. | |
| ```py | |
| # Override the default value | |
| InputParam.template("num_inference_steps", default=28) | |
| # Add a note to the description | |
| InputParam.template("prompt_embeds", note="batch-expanded") | |
| # description becomes: "text embeddings used to guide the image generation. ... (batch-expanded)" | |
| ``` | |
| ### OutputParam | |
| `OutputParam`, bir bloktan gelen tek bir çıktıyı tanımlar. | |
| | Alan | Tür | Açıklama | | |
| |---|---|---| | |
| | `name` | `str` | Parametrenin adı | | |
| | `type_hint` | `Any` | Tip anotasyonu | | |
| | `description` | `str` | İnsan okunabilir açıklama | | |
| | `kwargs_type` | `str` | İlgili parametreler için grup adı | | |
| | `metadata` | `dict` | İsteğe bağlı ek bilgiler | | |
| #### OutputParam'ı doğrudan oluşturma | |
| ```py | |
| from diffusers.modular_pipelines import OutputParam | |
| OutputParam(name="image_latents", type_hint=torch.Tensor, description="Encoded image latents.") | |
| ``` | |
| #### Şablon kullanma | |
| ```py | |
| OutputParam.template("latents") | |
| # Add a note to the description | |
| OutputParam.template("prompt_embeds", note="batch-expanded") | |
| ``` | |
| ## Mevcut şablonlar | |
| `INPUT_PARAM_TEMPLATES` ve `OUTPUT_PARAM_TEMPLATES`, [modular_pipeline_utils.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/modular_pipeline_utils.py) dosyasında tanımlanır. Bunlar `prompt`, `image`, `num_inference_steps`, `latents`, `prompt_embeds` gibi ortak parametreleri içerir. Kullanılabilir şablon adlarının tam listesi için kaynağa başvurun. | |
Xet Storage Details
- Size:
- 5.81 kB
- Xet hash:
- c2c16173467fcd3b55dccc7516cdb2c0a106517287011521735983195003c3d3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.