# Krea 2

نموذج Krea 2 (K2) هو نموذج لتوليد الصور من النص يعتمد على مطابقة التدفق (flow-matching)، مبني حول مكوّن MMDiT أحادي التيار مع انتباه الاستعلامات المجمّعة (grouped-query attention). يوفر مُشفّر النص Qwen3-VL شروط التوليد: بدلاً من استخدام حالة المخفي الأخيرة، تُستخرج حالات المخفي من اثني عشر طبقة فكّ ترميز لكل رمز، وتُدمج داخل محوّل التحويل (transformer) عبر مرحلة دمج نصية صغيرة. تُفكّ ترميز الصور باستخدام VAE الخاص بـ Qwen-Image.

تم إصدار نقطتي تفتيش، تتشاركان في نفس البنية المعمارية لكن مع إعدادات مُوصى بها مختلفة لمُعيّن العينات:

- **الأساسي (التدريب المتوسط)** — استخدم المُعيّن الكامل مع التوجيه الحر من التصنيف: `num_inference_steps=28`، `guidance_scale=4.5`.
- **تي دي إم (مُقطَّر)** — مُقطَّر لأخذ عينات بعدد خطوات قليل، يُشغَّل مع `num_inference_steps=8` وإيقاف التوجيه (`guidance_scale=0.0`).

يتبع `guidance_scale` اتفاقية Krea 2: حيث يُحسب السرعة على النحو `cond + guidance_scale * (cond - uncond)` ويُفعَّل التوجيه عندما يكون `guidance_scale > 0` (وهذا يعادل صياغة CFG المعتادة مع مقياس `1 + guidance_scale`).

## النص إلى صورة

```python
import torch
from diffusers import Krea2Pipeline

# Load from a local directory produced by the Krea 2 conversion (no hub repo yet).
pipe = Krea2Pipeline.from_pretrained("krea/Krea-2-Raw", dtype=torch.bfloat16)
pipe.to("cuda")  # or "mps", "xpu", "cpu"

prompt = "a fox in the snow"
image = pipe(
    prompt,
    height=1024,
    width=1024,
    num_inference_steps=28,
    guidance_scale=4.5,
    generator=torch.Generator("cuda").manual_seed(0),
).images[0]
image.save("krea2.png")
```

نوفر أيضًا مثالًا لاستخدام Krea2 Turbo :

```python
import torch
from diffusers import Krea2Pipeline

pipe = Krea2Pipeline.from_pretrained("krea/Krea-2-Turbo", dtype=torch.bfloat16)
pipe.to("cuda")  # or "mps", "xpu", "cpu"

image = pipe(
    "a fox in the snow",
    height=1024,
    width=1024,
    num_inference_steps=8,
    guidance_scale=0.0,
    generator=torch.Generator("cuda").manual_seed(0),
).images[0]
image.save("krea2_turbo.png")
```

## تحميل نقاط التفتيش أحادية الملف

```python
import torch
from diffusers import Krea2Pipeline, Krea2Transformer2DModel

transformer = Krea2Transformer2DModel.from_single_file(
    "https://huggingface.co/krea/Krea-2-Turbo/blob/main/turbo.safetensors", dtype=torch.bfloat16
)
pipe = Krea2Pipeline.from_pretrained("krea/Krea-2-Turbo", transformer=transformer, dtype=torch.bfloat16).to("cuda")
```

## Krea2Pipeline[[diffusers.Krea2Pipeline]]

#### diffusers.Krea2Pipeline[[diffusers.Krea2Pipeline]]

```python
diffusers.Krea2Pipeline(scheduler: FlowMatchEulerDiscreteScheduler, vae: AutoencoderKLQwenImage, text_encoder: Qwen3VLModel, tokenizer: AutoTokenizer, transformer: Krea2Transformer2DModel, text_encoder_select_layers: tuple[int, ...] | list[int] | None = None, is_distilled: bool = False, patch_size: int = 2)
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/pipelines/krea2/pipeline_krea2.py#L134)

**المعاملات:**

scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/v0.43.0/ar/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler)) : مجدول Euler لمطابقة التدفق. جدول Krea 2 لقيمة sigma هو إزاحة زمنية أسية واعية بالدقة، لذا يُتوقع أن يحدد تكوين المجدول `use_dynamic_shifting=True` معًا مع معاملات إزاحة Krea 2 (`base_shift=0.5`، `max_shift=1.15`، `base_image_seq_len=256`، `max_image_seq_len=6400`).

vae ([AutoencoderKLQwenImage](/docs/diffusers/v0.43.0/ar/api/models/autoencoderkl_qwenimage#diffusers.AutoencoderKLQwenImage)) : مُشفِّر-مُفكِّك التباين الخاص بـ Qwen-Image (f8، 16 قناة كامنة) المستخدم لتحويل الكامنات إلى صور.

text_encoder ([PreTrainedModel](https://huggingface.co/docs/transformers/v5.22.2/en/main_classes/model#transformers.PreTrainedModel)) : نموذج Qwen3-VL (مثل `Qwen3VLModel` الخاص بـ `Qwen/Qwen3-VL-4B-Instruct`). يستهلك خط المعالجة مجموعة من حالات الإخفاء المستخرجة من عدة طبقات فكّ الترميز بدلاً من حالة الإخفاء الأخيرة.

tokenizer ([AutoTokenizer](https://huggingface.co/docs/transformers/v5.22.2/en/model_doc/auto#transformers.AutoTokenizer)) : مُجزِّئ النص المرافق لمُشفِّر النص.

transformer ([Krea2Transformer2DModel](/docs/diffusers/v0.43.0/ar/api/models/krea2_transformer2d#diffusers.Krea2Transformer2DModel)) : نموذج MMDiT أحادي التدفق الخاص بـ Krea 2 الذي يتنبأ بسرعة مطابقة التدفق (flow-matching velocity).

text_encoder_select_layers (`tuple[int, ...]`، *اختياري*) : فهارس داخل مجموعة `hidden_states` الخاصة بمشفّر النص (حيث 0 هي مخرجات التضمين) التي تُكدّس حالاتها لكل رمز كشرط نصي للمحوّل. يجب أن تحتوي على `transformer.config.num_text_layers` من العناصر.

is_distilled (`bool`، *اختياري*، القيمة الافتراضية `False`) : ما إذا كان المحوّل هو نقطة الفحص المُقطّرة ذات الخطوات القليلة (TDM/turbo). عند تعيين `True`، يُستخدم إزاحة ثابتة لخطوة الزمن `mu=1.15`؛ وإلا يُحسب `mu` من دقة الصورة.

patch_size (`int`، *اختياري*، القيمة الافتراضية 2) : طول جانب المربعات التي تُجمَّع فيها الكمونات قبل دخول المحول. عامل تقليل الدقة الفعلي من البكسل إلى الرمز هو `vae_scale_factor * patch_size`.

خط أنابيب Krea 2 لتوليد الصور من النص.

#### __call__[[diffusers.Krea2Pipeline.__call__]]

```python
__call__(prompt: str | list[str] | None = None, negative_prompt: str | list[str] | None = None, height: int = 1024, width: int = 1024, num_inference_steps: int = 28, sigmas: list[float] | None = None, guidance_scale: float = 4.5, num_images_per_prompt: int = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, prompt_embeds_mask: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds_mask: typing.Optional[torch.Tensor] = None, output_type: str | None = 'pil', return_dict: bool = True, callback_on_step_end: typing.Optional[typing.Callable[[int, int, dict], NoneType]] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], attention_kwargs: dict[str, typing.Any] | None = None, max_sequence_length: int = 512)
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/pipelines/krea2/pipeline_krea2.py#L445)

**المعاملات:**

prompt (`str` أو `list[str]`، *اختياري*) : الأمر أو الأوامر التي تُوجّه توليد الصورة. إذا لم تُعرَّف، يجب تمرير `prompt_embeds`.

negative_prompt (`str` أو `list[str]`، *اختياري*) : الأمر أو الأوامر التي لا ينبغي توجيه توليد الصورة بها. يتم تجاهلها عندما يكون `guidance_scale <= 0`؛ الافتراضي هو أمر فارغ عند تمكين التوجيه.

height (`int`، القيمة الافتراضية 1024) : ارتفاع الصورة المولّدة بالبكسلات. يُقرَّب إلى أقرب مضاعف لـ 16 عند الحاجة.

width (`int`، القيمة الافتراضية 1024) : عرض الصورة المولدة بالبكسلات. يتم تقريبه لأعلى إلى مضاعف لـ 16 عند الحاجة.

num_inference_steps (`int`، القيمة الافتراضية 28) : عدد خطوات إزالة الضوضاء. استخدم 28 لنقطة التفتيش الأساسية (midtrain) و8 لنقطة التفتيش المُقطّرة ذات الخطوات القليلة (TDM).

sigmas (`list[float]`، *اختياري*) : قيم سيجما مخصصة للمجدول. إذا لم تُعرَّف، تُستخدم شبكة `linspace(1.0, 1/num_inference_steps, num_inference_steps)` الافتراضية (يتم تطبيق الإزاحة الواعية بالدقة داخل المجدول).

guidance_scale (`float`، القيمة الافتراضية 4.5) : مقياس التوجيه الحر من التصنيف، وفقاً لاتفاقية Krea 2: يتم حساب السرعة على النحو `cond + guidance_scale * (cond - uncond)` ويُفعَّل التوجيه كلما كان `guidance_scale > 0` (وهذا يعادل صياغة CFG المعتادة مع مقياس `1 + guidance_scale`). اضبطه على `0.0` لتعطيله (مثلاً لنقطة التفتيش TDM).

num_images_per_prompt (`int`، القيمة الافتراضية 1) : عدد الصور التي سيتم توليدها لكل موجه.

generator (`torch.Generator` أو `list[torch.Generator]`، *اختياري*) : مولّد أو أكثر من [مولّدات torch](https://pytorch.org/docs/stable/generated/torch.Generator.html) لجعل التوليد حتميًا.

latents (`torch.Tensor`, *اختياري*) : كامنات ضجيج مُولّدة مسبقًا في شكل مُجمّع `(batch_size, image_seq_len, in_channels)`، مُستخرجة من توزيع غاوسي، تُستخدم كمدخلات لتوليد الصور.

prompt_embeds (`torch.Tensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا ذات الشكل `(batch_size, text_seq_len, num_text_layers, text_hidden_dim)`. إذا لم تُقدَّم، يتم توليد التمثيلات من `prompt`.

prompt_embeds_mask (`torch.Tensor`، *اختياري*) : قناع منطقي لـ`prompt_embeds`؛ مطلوب عند تمرير `prompt_embeds`.

negative_prompt_embeds (`torch.Tensor`، *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا؛ بنفس التخطيط مثل `prompt_embeds`.

negative_prompt_embeds_mask (`torch.Tensor`، *اختياري*) : قناع منطقي لـ`negative_prompt_embeds`؛ مطلوب عند تمرير `negative_prompt_embeds`.

output_type (`str`، *اختياري*، الافتراضي `"pil"`) : صيغة الصورة المولّدة. اختر بين `"pil"`، `"np"`، `"pt"` أو `"latent"`.

return_dict (`bool`، *اختياري*، الافتراضي `True`) : ما إذا كان يجب إرجاع [Krea2PipelineOutput](/docs/diffusers/v0.43.0/ar/api/pipelines/krea2#diffusers.pipelines.krea2.Krea2PipelineOutput) بدلاً من tuple عادي.

callback_on_step_end (`Callable`، *اختياري*) : دالة تُستدعى في نهاية كل خطوة إزالة ضوضاء مع `callback_on_step_end(self, step, timestep, callback_kwargs)`.

callback_on_step_end_tensor_inputs (`list[str]`، *اختياري*، القيمة الافتراضية `["latents"]`) : قائمة مدخلات المصفوفات (tensors) لدالة `callback_on_step_end`. يجب أن تكون مجموعة فرعية من `._callback_tensor_inputs`.

attention_kwargs (`dict`، *اختياري*) : قاموس kwargs يُمرَّر إلى `AttentionProcessor` إذا تم تحديده، كما هو معرَّف تحت `self.processor` في [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).

max_sequence_length (`int`، القيمة الافتراضية 512) : طول تسلسل النص الثابت الذي يستهلكه المحوّل؛ يتم ملء الأوامر أو اقتطاعها لتطابق هذا الطول.

**يعيد:** [Krea2PipelineOutput](/docs/diffusers/v0.43.0/ar/api/pipelines/krea2#diffusers.pipelines.krea2.Krea2PipelineOutput) أو `tuple`

`return_dict` إذا كانت `tuple`، وإلا فهي [Krea2PipelineOutput](/docs/diffusers/v0.43.0/ar/api/pipelines/krea2#diffusers.pipelines.krea2.Krea2PipelineOutput)، حيث يكون العنصر الأول منها قائمة بالصور المولّدة.

الدالة التي تُستدعى عند استدعاء خط الأنابيب للتوليد.

أمثلة:
```py
>>> import torch
>>> from diffusers import Krea2Pipeline

>>> # Load from a local directory produced by the Krea 2 conversion (no hub repo yet).
>>> pipe = Krea2Pipeline.from_pretrained("path/to/krea2-diffusers", torch_dtype=torch.bfloat16)
>>> pipe.to("cuda")
>>> prompt = "a fox in the snow"
>>> # Base (midtrain) checkpoint defaults. For the few-step distilled (TDM) checkpoint use
>>> # `num_inference_steps=8, guidance_scale=0.0` instead.
>>> image = pipe(prompt, num_inference_steps=28, guidance_scale=4.5).images[0]
>>> image.save("krea2.png")
```

#### encode_prompt[[diffusers.Krea2Pipeline.encode_prompt]]

```python
encode_prompt(prompt: str | list[str], device: typing.Optional[torch.device] = None, num_images_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, prompt_embeds_mask: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 512)
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/pipelines/krea2/pipeline_krea2.py#L263)

**المعاملات:**

prompt (`str` أو `list[str]`، *اختياري*) : النص الذي سيتم ترميزه

device : (`torch.device`): جهاز torch

num_images_per_prompt (`int`) : عدد الصور التي يجب توليدها لكل موجه

prompt_embeds (`torch.Tensor`, *اختياري*) : تمثيلات نصية مُولّدة مسبقًا ذات الشكل `(batch_size, text_seq_len, num_text_layers, text_hidden_dim)`. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد التمثيلات النصية من معامل الإدخال `prompt`.

prompt_embeds_mask (`torch.Tensor`، *اختياري*) : قناع منطقي مُولّد مسبقًا يحدد الرموز النصية الصالحة، بأبعاد `(batch_size, text_seq_len)`. مطلوب عند تمرير `prompt_embeds`.

max_sequence_length (`int`، القيمة الافتراضية 512) : طول تسلسل النص الثابت الذي يستهلكه المحوّل؛ يتم ملء الأوامر أو اقتطاعها لتطابق هذا الطول.

#### get_text_hidden_states[[diffusers.Krea2Pipeline.get_text_hidden_states]]

```python
get_text_hidden_states(prompt: str | list[str], max_sequence_length: int = 512, device: typing.Optional[torch.device] = None)
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/pipelines/krea2/pipeline_krea2.py#L214)

قم بتجزئة `prompt` إلى تخطيط Krea 2 ذي الطول الثابت واستخرج حالات المُشفِّر المختارة المخفية.

يعيد مجموعة `(hidden_states, attention_mask)` بأشكال `(batch_size, text_seq_len, num_text_layers, text_hidden_dim)` و`(batch_size, text_seq_len)` (bool).

#### prepare_position_ids[[diffusers.Krea2Pipeline.prepare_position_ids]]

```python
prepare_position_ids(text_seq_len: int, grid_height: int, grid_width: int, device: device)
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/pipelines/krea2/pipeline_krea2.py#L381)

أنشئ إحداثيات الدوران `(text_seq_len + grid_height * grid_width, 3)` للتسلسل المدمج: حيث تتخذ رموز النص نقطة الأصل، بينما تحمل رموز الصورة إحداثيات الشبكة الكامنة `(0, h, w)` الخاصة بها.

## Krea2PipelineOutput[[diffusers.pipelines.krea2.Krea2PipelineOutput]]

#### diffusers.pipelines.krea2.Krea2PipelineOutput[[diffusers.pipelines.krea2.Krea2PipelineOutput]]

```python
diffusers.pipelines.krea2.Krea2PipelineOutput(images: list[PIL.Image.Image] | numpy.ndarray)
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/pipelines/krea2/pipeline_output.py#L24)

**المعاملات:**

images (`list[PIL.Image.Image]` أو `np.ndarray`) : قائمة من صور PIL منزوعة الضوضاء بطول `batch_size` أو مصفوفة numpy بأبعاد `(batch_size, height, width, num_channels)`.

فئة الإخراج لخط أنابيب Krea 2.

## المنفصلة

يتوفر Krea 2 أيضاً على شكل [خط أنابيب معياري](../../modular_diffusers/overview). يتم تكوينClassifier-free guidance من خلال مكوّن `guider` بدلاً من معامل استدعاء `guidance_scale`. يستخدم Krea 2 تقنية cond-anchored CFG، وهي [ClassifierFreeGuidance](/docs/diffusers/v0.43.0/ar/api/modular_diffusers/guiders#diffusers.ClassifierFreeGuidance) مع `use_original_formulation=True`.

```python
import torch
from diffusers import ClassifierFreeGuidance, ModularPipeline

pipe = ModularPipeline.from_pretrained("krea/Krea-2-Raw")
pipe.load_components(dtype=torch.bfloat16)
pipe.to("cuda")  # or "mps", "xpu", "cpu"

image = pipe(
    prompt="a fox in the snow",
    height=1024,
    width=1024,
    num_inference_steps=28,
    generator=torch.Generator("cuda").manual_seed(0),
).images[0]
image.save("krea2.png")
```

نوفّر أيضاً مثالاً لاستخدام Krea2 Turbo. يُخضع نقطة التفتيش المُقطّرة إلى مجموعة خاصة من الكتل ([Krea2TurboAutoBlocks](/docs/diffusers/v0.43.0/ar/api/pipelines/krea2#diffusers.Krea2TurboAutoBlocks)): فهي تعمل دون توجيه (بدون `guider`)، ولا تستقبل أي موجه سلبي، وتُنتج العينات في خطوات قليلة. يختار `ModularPipeline.from_pretrained` كتل turbo تلقائياً من إعداد `is_distilled` الخاص بنقطة التفتيش، لذا لا حاجة إلى أي إعداد للتوجيه:

```python
import torch
from diffusers import ModularPipeline

pipe = ModularPipeline.from_pretrained("krea/Krea-2-Turbo")
pipe.load_components(dtype=torch.bfloat16)
pipe.to("cuda")  # or "mps", "xpu", "cpu"

image = pipe(
    prompt="a fox in the snow",
    height=1024,
    width=1024,
    num_inference_steps=8,
    generator=torch.Generator("cuda").manual_seed(0),
).images[0]
image.save("krea2_turbo.png")
```

## Krea2ModularPipeline[[diffusers.Krea2ModularPipeline]]

#### diffusers.Krea2ModularPipeline[[diffusers.Krea2ModularPipeline]]

```python
diffusers.Krea2ModularPipeline(blocks: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None, pretrained_model_name_or_path: str | os.PathLike | None = None, components_manager: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None, collection: str | None = None, workflow: str | None = None, modular_config_dict: dict[str, typing.Any] | None = None, config_dict: dict[str, typing.Any] | None = None, **kwargs)
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/modular_pipelines/krea2/modular_pipeline.py#L19)

خط أنابيب معياري لـ Krea 2.

## Krea2AutoBlocks[[diffusers.Krea2AutoBlocks]]

#### diffusers.Krea2AutoBlocks[[diffusers.Krea2AutoBlocks]]

```python
diffusers.Krea2AutoBlocks()
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/modular_pipelines/krea2/modular_blocks_krea2.py#L106)

خط أنابيب Auto Modular لتوليد الصور من النص باستخدام Krea 2: ترميز النص -> إزالة الضوضاء الأساسية (CFG متماثل) -> فك الترميز.

سير العمل المدعومة:
- `text2image`: يتطلب `prompt`

المكوّنات: text_encoder (`Qwen3VLModel`): مُشفّر النص الخاص بـ Qwen3-VL. tokenizer (`AutoTokenizer`): مُجزّئ الرموز المرافق لمُشفّر النص. guider (`ClassifierFreeGuidance`) transformer (`Krea2Transformer2DModel`) scheduler (`FlowMatchEulerDiscreteScheduler`) vae (`AutoencoderKLQwenImage`) image_processor (`VaeImageProcessor`)

المدخلات: prompt (`str`): الأمر أو الأوامر الموجِّهة لتوليد الصورة. negative_prompt (`str`, *اختياري*): الأمر(الأوامر) السالب(السالبة) لـ CFG. max_sequence_length (`int`, *اختياري*, الافتراضي 512): الحد الأقصى لطول التسلسل لتشفير الأمر. num_images_per_prompt (`int`, *اختياري*, الافتراضي 1): عدد الصور المراد توليدها لكل أمر. latents (`Tensor`, *اختياري*): كامنات ضجيج مُولَّدة مسبقًا لتوليد الصورة. height (`int`, *اختياري*, الافتراضي 1024): ارتفاع الصورة المولَّدة بالبكسل. width (`int`, *اختياري*, الافتراضي 1024): عرض الصورة المولَّدة بالبكسل. generator (`Generator`, *اختياري*): مولّد Torch لتوليد حتمي. num_inference_steps (`int`, *اختياري*, الافتراضي 28): عدد خطوات إزالة الضجيج. sigmas (`list`, *اختياري*): جدول سيجما مخصص (الافتراضي هو منحدر خطي). attention_kwargs (`dict`, *اختياري*): معاملات إضافية لمعالجات الانتباه. output_type (`str`, *اختياري*, الافتراضي pil): صيغة الإخراج: 'pil'، 'np'، 'pt'.

المخرجات: صور (`list`): الصور المولّدة.

## Krea2TurboModularPipeline[[diffusers.Krea2TurboModularPipeline]]

#### diffusers.Krea2TurboModularPipeline[[diffusers.Krea2TurboModularPipeline]]

```python
diffusers.Krea2TurboModularPipeline(blocks: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None, pretrained_model_name_or_path: str | os.PathLike | None = None, components_manager: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None, collection: str | None = None, workflow: str | None = None, modular_config_dict: dict[str, typing.Any] | None = None, config_dict: dict[str, typing.Any] | None = None, **kwargs)
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/modular_pipelines/krea2/modular_pipeline.py#L54)

ModularPipeline لنقطة التفتيش المُصغّرة من Krea 2 turbo (TDM). يعمل دون توجيه حر من المُصنّف، لذا لا يستقبل أي موجه سلبي ولا يحتوي على مُوجِّه.

## Krea2TurboAutoBlocks[[diffusers.Krea2TurboAutoBlocks]]

#### diffusers.Krea2TurboAutoBlocks[[diffusers.Krea2TurboAutoBlocks]]

```python
diffusers.Krea2TurboAutoBlocks()
```

[المصدر](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/modular_pipelines/krea2/modular_blocks_krea2_turbo.py#L102)

خط أنابيب Auto Modular لتوليد الصور من النص باستخدام نقطة الفحص المُصغّرة Krea 2 turbo: ترميز النص -> إزالة الضوضاء الأساسية (بدون توجيه) -> فك الترميز.

سير العمل المدعومة:
- `text2image`: يتطلب `prompt`

المكوّنات: text_encoder (`Qwen3VLModel`): مُشفّر النص الخاص بـ Qwen3-VL. tokenizer (`AutoTokenizer`): مُجزّئ الرموز المرافق لمُشفّر النص. transformer (`Krea2Transformer2DModel`) scheduler (`FlowMatchEulerDiscreteScheduler`) vae (`AutoencoderKLQwenImage`) image_processor (`VaeImageProcessor`)

المدخلات: prompt (`str`): الأمر أو الأوامر التي تُوجّه توليد الصورة. max_sequence_length (`int`, *اختياري*, الافتراضي 512): الحد الأقصى لطول التسلسل لتشفير الأمر. num_images_per_prompt (`int`, *اختياري*, الافتراضي 1): عدد الصور التي سيتم توليدها لكل أمر. latents (`Tensor`, *اختياري*): كامنات ضجيج مُولّدة مسبقًا لتوليد الصورة. height (`int`, *اختياري*, الافتراضي 1024): ارتفاع الصورة المولّدة بالبكسل. width (`int`, *اختياري*, الافتراضي 1024): عرض الصورة المولّدة بالبكسل. generator (`Generator`, *اختياري*): مولّد Torch لتوليد حتمي. num_inference_steps (`int`, *اختياري*, الافتراضي 8): عدد خطوات إزالة الضجيج. sigmas (`list`, *اختياري*): جدول سيجما مخصص (الافتراضي هو منحدر خطي). attention_kwargs (`dict`, *اختياري*): معاملات إضافية لمعالجات الانتباه. output_type (`str`, *اختياري*, الافتراضي pil): صيغة الإخراج: 'pil'، 'np'، 'pt'.

المخرجات: صور (`list`): الصور المولّدة.

