# Flujo de trabajo de Texto a imagen

## **1.** ¿Cómo iniciar el flujo de trabajo de Texto a imagen?

#### Paso 1. Haz clic en **ComfyUI** y crea un nuevo flujo de trabajo.

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/Ex49voKL7HjCqi7pTTqo/image.png" alt=""><figcaption></figcaption></figure>

#### Paso 2. Añade el flujo de trabajo básico de Texto a imagen.

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/Bf3TIJbfYys4ny5kAruc/%E6%96%87%E7%94%9F%E5%9B%BE.png" alt="Process of text-to-image workflow"><figcaption></figcaption></figure>

El flujo de trabajo en ComfyUI es similar al de Web UI:

<mark style="background-color:yellow;">**Seleccionar un modelo → Introducir el prompt → Ajustar parámetros → Generar imagen**</mark>

Parámetros

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/qNYrARm8MHy74oIgnmRH/%E6%8E%A7%E5%88%B6%E7%A7%8D%E5%AD%90.png" alt="Text to Image Workflow - KSampler parameters"><figcaption></figcaption></figure>

> **control\_after\_generate**: controla la generación de la semilla
>
> **fixed**: fija la semilla
>
> **increment:** suma 1 a la semilla existente
>
> **decrement:** resta 1 a la semilla existente
>
> **randomize:** genera una semilla aleatoria

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/p1vtVJq6HDOq7sM9k3ps/%E8%B0%83%E5%BA%A6%E5%99%A8.png" alt="Text to Image Workflow - scheduler parameters"><figcaption></figcaption></figure>

> **scheduler:** generalmente se elige entre normal o Karras.> \
> **denoise:** que indica la intensidad de la reducción de ruido en la generación de imágenes, cuanto mayor sea el valor, mayor será el impacto y el cambio en la imagen.

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/egBNygiTHhQHFDz6spLf/%E5%B0%BA%E5%AF%B8.png" alt="Text to Image Workflow - image size settings"><figcaption></figcaption></figure>

> **Tamaños recomendados:**
>
> SD1.5: 512*512*&#x20;
>
> *SDXL: 1024*1024

## 2. ¿Cómo añadir un nodo?

### 2.1 Añadir KSampler

Primero, agrega un nodo principal: **KSampler**

* Clic derecho: <mark style="background-color:yellow;">**Añadir nodo → muestreo → KSampler**</mark>

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/Jj2hiz2TmmOw69W2k5PZ/%E5%BB%BA%E7%AB%8B%E9%87%87%E6%A0%B7%E5%99%A8.png" alt="Steps for adding KSampler" width="505"><figcaption></figcaption></figure>

### 2.2 Extrae el nodo

**Luego extrae el nodo del muestreador y añade los nodos correspondientes:**

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/AeCTFKo5NIMZXuhJNWog/%E6%8B%89%E5%87%BA.png" alt="Text to Image Workflow - pull out the sampler node and add the corresponding nodes" width="460"><figcaption></figcaption></figure>

> model → CheckpointLoaderSimple
>
> positive → CLIPTextEncode
>
> negative → CLIPTextEncode
>
> latent\_image → EmptyLatentImage
>
> LATENT → VAEDecode
>
> IMAGE → SaveImage

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/DJ27TDC3UbdshA11gUFu/%E6%8B%89%E8%8A%82%E7%82%B9.png" alt="Text to Image Workflow - Steps of pulling out the node"><figcaption></figcaption></figure>

### 2.3 ¿Cómo añadir LoRA?

* Loaders: se utilizan principalmente para cargar el modelo de difusión, incluyendo el modelo base y LoRA.

**Añadir Node→loaders→Load LoRA**

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/fDPH0w1NPvI06NgNUCT7/%E5%8A%A0%E8%BD%BDlora.png" alt="Steps to add LoRA"><figcaption></figcaption></figure>

### 2.4 ¿Cómo añadir Clip Ski&#x70;**?**

* Conditioning: guían al modelo de difusión para generar resultados específicos, e incluyen elementos como **Prompt**, **ControlNet**, **Clip Skip**, entre otros.

Se recomienda añadir **Clip Skip** para controlar las capas que se omiten, lo cual ayuda a ajustar los detalles finales de la imagen.

**Añadir Node→conditioning→CLIP Set Last Layer**

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/yLxC27H7XCYNPuy50d0B/%E5%B1%82%E7%BA%A7.png" alt="Steps to add Clip Skip"><figcaption></figcaption></figure>

### 2.5 Conectar los nodos

Después de añadir nodos, es posible que muchos de ellos aún no estén conectados. Es necesario conectarlos en orden según la secuencia y los colores coincidentes.

**Checkpoint→LoRA→Clip Skip→Prompt→KSampler、Empty Latent Image→VAE Decode→Save Image**

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/EqWqEMMNW0gFqVlRxFxU/%E9%A2%9C%E8%89%B2%E8%BF%9E%E7%BA%BF.png" alt="Process to connect nodes"><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/dDuvvduukDXByFRQqrf6/%E6%90%AD%E5%BB%BA%E5%AE%8C%E6%88%90.png" alt="Steps to connect nodes"><figcaption></figcaption></figure>

## 3. Iniciar la generación de Texto a imagen

#### 3.1 Elije un Checkpoint

#### 3.2 Selecciona LoRA y ajustar los pesos

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/SD0Fyl4zODcGSbtjRmJh/%E9%80%89lora%E6%9D%83%E9%87%8D.png" alt="Text to image workflow - select LoRA and adjust the weights"><figcaption></figcaption></figure>

**3.3 Configura Clip Skip**, normalmente se recomienda fijarlo en **-2**

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/QvBTCi2Fx3qKHYmA3obF/%E5%B1%82%E7%BA%A7%E8%B7%B3%E8%BF%87.png" alt="Text to image workflow - set Clip Skip"><figcaption></figcaption></figure>

**3.4 Ingresa el prompt de texto**

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/KNwvUg04rfTzs8IyTgzk/%E6%8F%90%E7%A4%BA%E8%AF%8D.png" alt="Text to image workflow - enter prompts" width="272"><figcaption></figcaption></figure>

**3.5 Configura los parámetros necesarios**

El modelo elegido es el SDXL, por lo que hay que ajustar los pasos de muestreo a unos <mark style="background-color:yellow;">40</mark> y el tamaño de la imagen a <mark style="background-color:yellow;">1024\*1024</mark>.

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/NgXnsVrRCQtVobTBngTe/%E8%AE%BE%E7%BD%AE%E5%8F%82%E6%95%B0.png" alt="Text to image workflow - set relevant parameters"><figcaption></figcaption></figure>

#### 3.6 Haz clic en "Generar"

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/eKCZBfRB8KdBzhPyU23q/%E5%88%9B%E4%BD%9C.png" alt="Text to image workflow - click the Generate button"><figcaption></figcaption></figure>

#### 3.7 Vea los resultados

<figure><img src="https://content.gitbook.com/content/1y3zrHPB2l8reoeyLIjC/blobs/GyztmZuxAW4zfir69MI3/%E6%9F%A5%E7%9C%8B%E7%BB%93%E6%9E%9C.png" alt="View the results in History"><figcaption></figcaption></figure>
