Outils pour utilisateurs

Outils du site


issue203:stable_diffusion

You may remember the last time I introduced the ComfyUI interface to Stable Diffusion. Hopefully it enticed some readers, and this article is an explanation of how to install it. I wanted to do a clean install, and accomplished that by using a V-NAND connected via USB on which I had previously installed Ubuntu Studio. There are several installation web pages available which are essentially the same. I used the Yushan777 version, which also includes a windows install, and is found here: https://medium.com/@yushantripleseven/installing-comfyui-linux-windows-b59a57af61b6 It does require Python 3.10 and Git. It is installed via a few lines pasted in terminal, and begins by cloning the repository. First make an appropriate directory: mkdir ai, in your home directory for example. Then clone the repo by using terminal in that new directory using: git clone https://github.com/comfyanonymous/ComfyUI.git In a few minutes it responds with done; then change to the newly created subdirectory (cd ComfyUI), and input: python3 -m venv venv, to create a virtual environment – named venv in this example. Make it active via: source venv/bin/activate. The prompt should now be prefixed with (venv).

Vous vous souvenez peut-être que, la dernière fois, j'ai présenté l'interface ComfyUI pour Stable Diffusion. J'espère qu'elle a séduit quelques lecteurs ; cet article explique comment l'installer. Je voulais faire une installation propre, et j'ai utilisé une V-NAND connectée par USB sur laquelle j'avais déjà installé Ubuntu Studio. Il existe plusieurs pages Web d'installation qui sont fondamentalement les mêmes. J'ai utilisé la version de Yushan777, qui comprend également une installation pour Windows, et qui se trouve ici : https://medium.com/@yushantripleseven/installing-comfyui-linux-windows-b59a57af61b6

Python 3.10 et Git sont nécessaires. L'interface s'installe via quelques lignes collées dans le terminal, et commence par cloner le dépôt. Créez d'abord un répertoire approprié : mkdir ai, dans votre répertoire personnel par exemple. Ensuite, dans le terminal, clonez le dépôt dans ce nouveau répertoire en utilisant :

git clone https://github.com/comfyanonymous/ComfyUI.git

Au bout de quelques minutes, le terminal répondra « done » ; passez alors dans le sous-répertoire nouvellement créé (cd ComfyUI), et entrez : python3 -m venv venv, pour créer un environnement virtuel - nommé venv dans cet exemple. Activez-le via : source venv/bin/activate. Le prompt devrait maintenant être préfixé par (venv).

Next, dependencies are added: pip install torch torchvision torchaudio –extra-index-url https://download.pytorch.org/whl/cu121 This will take several minutes, but you are almost done. Lastly, install additional dependencies: pip install -r requirements.txt Although at this point, the installation is complete, you will want to add two other things. To launch ComfyIU easier, create a launch file, for example a plain text file “launch.sh” in the ComfyUI directory to activate the VENV and start ComfyUI I with two lines: source venv/bin/activate python3 main.py Running the program ./launch.sh with terminal in that directory, will start ComfyUI but it will not allow you to produce any images. You need to install a model. I used: ghostmix_v20Bakedvae.safetensors https://civitai.com/images/862133 because it’s a relatively small file, 2.2 GB. Although it’s not an SDXL model, they could be used if your video card is sufficient. AMD video cards may be used but additional AMD drivers will need to be installed. Safetensors and Checkpoint models need to be copied into the Models/Checkpoint subdirectory. If no model is added, the Load Checkpoint node will be circled in red when attempting to produce an image as shown (below).

Ensuite, les dépendances sont ajoutées :

pip install torch torchvision torchaudio –extra-index-url https://download.pytorch.org/whl/cu121

Cela prendra plusieurs minutes, mais vous avez presque terminé. Enfin, installez les dépendances supplémentaires :

pip install -r requirements.txt

Bien qu'à ce stade, l'installation soit terminée, vous devez ajouter deux autres choses. Pour lancer ComfyIU plus facilement, créez un fichier de lancement, par exemple un fichier texte « launch.sh » dans le répertoire ComfyUI pour activer VENV et démarrer ComfyUI avec deux lignes :

source venv/bin/activate

python3 main.py

Exécution du programme

Quand le terminal est dans ce répertoire,

./launch.sh

démarrera ComfyUI mais ne vous permettra pas de produire des images. Vous devez installer un modèle. J'ai utilisé : ghostmix_v20Bakedvae.safetensors https://civitai.com/images/862133 parce que c'est un fichier relativement petit, 2,2 Go. Bien qu'il ne s'agisse pas d'un modèle SDXL, il peut être utilisé si votre carte vidéo est suffisante. Les cartes vidéo AMD peuvent être utilisées, mais des pilotes AMD supplémentaires devront être installés. Les modèles Safetensors et Checkpoint doivent être copiés dans le sous-répertoire Models/Checkpoint. Si aucun modèle n'est ajouté, le nœud Load Checkpoint sera entouré de rouge lors de la tentative de production d'une image, comme démontré ci-dessous.

Using the default positive and negative prompts will produce a 512x 512 image such as that shown on the next page, top right. At the same location where examples of outputs can be found for the Ghostmix model, you can find prompts to produce impressive images. Using the below Positive and Negative prompts will allow you to produce something like the below. The output was 1024 x 1024, resized in the Empty Latent Image node, which was resized back down for this article (provided prompts can be used with any model). Positive Prompt: 1mechanical girl,1), portrait, global illumination, shadows, octane render, 8k, ultra sharp, metal, intricate, ornaments detailed, cold colors, egyptian detail, highly intricate details, realistic light, trending on cgsociety, glowing eyes, facing camera, neon details, mechanical limbs, blood vessels connected to tubes, mechanical vertebra attaching to back, mechanical cervical attaching to neck, sitting, wires and cables connecting to head

L'utilisation des invites positives et négatives par défaut permet de produire une image de 512 x 512 telle que celle illustrée sur la page suivante, en haut à droite.

Au même endroit où vous trouverez des exemples de sorties pour le modèle Ghostmix, vous trouverez des invites pour produire des images impressionnantes. L'utilisation des invites positives et négatives ci-dessous vous permettra de produire quelque chose comme l'image ci-dessous. La sortie était de 1024 x 1024, redimensionnée dans le nœud Empty Latent Image, dont la taille a été réduite pour cet article (les invites fournies peuvent être utilisées avec n'importe quel modèle).

Invite positive : 1mechanical girl,2), portrait, global illumination, shadows, octane render, 8k, ultra sharp, metal, intricate, ornaments detailed, cold colors, egyptian detail, highly intricate details, realistic light, trending on cgsociety, glowing eyes, facing camera, neon details, mechanical limbs, blood vessels connected to tubes, mechanical vertebra attaching to back, mechanical cervical attaching to neck, sitting, wires and cables connecting to head

Negative Prompt: NSFW, 3d, cartoon, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name, young, loli, elf, 3d, illustration ng_deepnegative_v1_75t At this point you are ready to go, but there is one more addition worthy of adding (there are many more, but this is the way to start). In the Queue Prompt node, there are some extra options available when checking that option as shown. But after loading the ComfyUI Manager Menu, two additional options are added to the Queue Prompt node. Pressing the Manager button provides many options including updates and the ability to add others. (More about this in the next article). To add the Manager, bring up the terminal in the ComfyUI/custom_nodes directory and run: git clone https://github.com/ltdrdata/ComfyUI-Manager.git After restarting ComfyUI, you should notice the Manager button option. The colored button labeled Share allows you to publish your work in a variety of appropriate web locations. We will address some of these options next time.

Invite négative : NSFW, 3d, cartoon, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name, young, loli, elf, 3d, illustration ng_deepnegative_v1_75t

À ce stade, tout est prêt, mais il y a encore une addition qui mérite d'être ajoutée (il y en a beaucoup d'autres, mais c'est ainsi qu'il faut commencer). Dans le noeud Queue Prompt, quelques options supplémentaires seront disponibles lorsque l'on coche cette option comme indiqué. Mais après avoir chargé le menu du gestionnaire ComfyUI, deux options supplémentaires sont ajoutées au nœud Queue Prompt. Un appui sur le bouton Manager rend disponibles de nombreuses options, y compris des mises à jour et la possibilité d'en ajouter d'autres. (Plus d'informations à ce sujet dans le prochain article).

Pour ajouter le Manager, ouvrez le terminal dans le répertoire ComfyUI/custom_nodes et exécutez :

git clone https://github.com/ltdrdata/ComfyUI-Manager.git

Après avoir redémarré ComfyUI, vous devriez remarquer l'option du bouton Manager. Le bouton coloré intitulé Share (Partager) vous permet de publier votre travail dans une variété d'emplacements Web appropriés. Nous aborderons certaines de ces options la prochaine fois.

1) , 2)
ultra realistic details
issue203/stable_diffusion.txt · Dernière modification : 2024/04/03 17:05 de andre_domenech