Нейронные сети (картинки)
StableDifusion
Установка
1. Установить гит https://git-scm.com/download/win
2. Установить python 3.10.6 (https://www.python.org/downloads/windows/) c галкой add to PATH
3. Установить CUDA https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local
4. в git bush (или в VC в терминале)
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
Создаст папку там где запущен баш (C:\Users\Misha\stable-diffusion-webui)
git pull — чтобы обновить (из папки stable-diffusion-webui)
Или скачать https://github.com/AUTOMATIC1111/stable-diffusion-webui/archive/refs/tags/v1.6.0.zip
5. Запустить webui-user.bat (ждать 15 мин)
Если ловим ошибку TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument ‘socket_options’
source venv/Scripts/activate
pip install httpx==0.24.1
Для автоматического обновления — дописать в код webui-user.bat
@echo off
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS= --autolaunch --xformers --medvram --opt-sdp-attention
git pull
call webui.bat
Если xformers не поставился
set COMMANDLINE_ARGS= --reinstall-xformers --xformers
xformers нужен для снижения нагрузки на видеокарту, работает на архитектурах: turing, hopper, pascal, ampere, ada lovelace
6. Ставим свои модели в C:\StableDifusion\stable-diffusion-webui-1.6.0\models\Stable-diffusion
7. Чтобы поменять значения при запуске — редактировать ui-config.json
Автономная версия (xrist)
Не работают XL модели
https://github.com/serpotapov/stable-diffusion-portable
разархивировать — webui-user-first-run.cmd
Модели ставить сюда
C:\stable-diffusion-portable-main\models\Stable-diffusion\
Запускать тут
webui-user.bat
Дополнительные модели
https://civitai.com/models
https://huggingface.co/XpucT/Deliberate/tree/main
mj — в начале промта чтобы эмулировать стиль миджорни
cinematic — добавить кинематографичности
cozy — добавить уюта
https://civitai.com/models/125703/protovision-xl-high-fidelity-3d-photorealism-anime-hyperrealism-no-refiner-needed
Локальный сервер
Отредактировать webui.py
def webui():
app, local_url, share_url = shared.demo.launch(
#share=cmd_opts.share,
share=True,
server_name=server_name,
server_port=cmd_opts.port,
ssl_keyfile=cmd_opts.tls_keyfile,
ssl_certfile=cmd_opts.tls_certfile,
debug=cmd_opts.gradio_debug,
auth=[tuple(cred.split(':')) for cred in gradio_auth_creds] if gradio_auth_creds else None,
inbrowser=cmd_opts.autolaunch,
prevent_thread_lock=True
)
Обучение на LORA
https://github.com/serpotapov/Kohya_ss-GUI-LoRA-Portable
Для каждой версии семплера — отдельная лора (1.5; XL)
Extra networks — Add hypernetwork to promt — none (для обучений)
Путь куда класть фотки (примерно 16)
Тренировать на 2й вкладке — dreamboots Lora
C:_StableDifusion\Train\100_Misha
В настройках указать папку в которой лежит папка 100_Misha
При начале трейна сразу удалять появившуюся папку smple
Дополнительные аддоны
На вкладке Extentions
Ставятся в C:\_StableDifusion\stable-diffusion-portable-main\extensions\
dynamic thresholding — https://github.com/mcmonkeyprojects/sd-dynamic-thresholding
ControlNet
В Extension: sd-webui-controlnet manipulations
Сами модели https://huggingface.co/lllyasviel/ControlNet/tree/main/models
Ставить сюда C:_StableDifusion\stable-diffusion-portable-main\extensions\sd-webui-controlnet\models
canny — контуры
mlsd — интерьеры
openpose — копирование поз
scribble — раскраска скетча
Scribble/Sketch — по скетчу генерирует изображения
Про CONTROLNET
https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main
Промты
Кот в шапке санты
cat in santa hat, (((ink))), ((((grayscale)))),
Концепт для магической книги рецептов
Full page concept design how to craft life Poison, intricate details,infographic of alchemical, diagram of how to make potions, captions, directions, ingredients, drawing , magic,wuxia
Для артов
a highly detailed epic cinematic concept art an alien pyramid landscape , art station, landscape, concept art, illustration, highly detailed artwork cinematic, hyper realistic painting
Декор
environment living room interior, mid century modern, indoor garden with fountain, retro,m vintage,
designer furniture made of wood and plastic, concrete table, wood walls, indoor potted tree, large window, outdoor forest landscape, beautiful sunset, cinematic, concept art, sunstainable architecture, octane render, utopia, ethereal, cinematic light, –ar 16:9 –stylize 45000
Открытка
beautiful fashion elegant goddness of water, chic strapless dress, tropical sea background, character design, in the style of artgerm, and wlop, chanel jewelry, cinematic lighting, hyperdetailed, 8 k realistic, symmetrical, global illumination, radiant light, love and mercy, frostbite 3 engine, cryengine, dof, trending on artstation, digital art, crepuscular ray
Готичный лев
ultra wide angle, in focus, dark epic background, gorgeous lifelike, moody golden fur design, dynamic pose of a lion, the full and whole body, full length shot, hyper details, lighting art, cinematic, insane details, intricate details, hyperdetailed, goth, fractal, dark shot
Статуя в музее
inside museum, alabaster statue, (made of marble:1.2), antique statue, Greek Goddess of beauty, medium boobs, 1girl, wide hips, nipples, detailed hands, ilya kuvshinov, raymond swanland, james gilleard, very detailed, 8k, hd, full color
Девушка на фоне города
night,neon lights,cyberpunk,city, cityscape,The views of the buildings are stunning,detailed background,depth of field,boken,\\ (masterpiece), best quality, highest quality, extremely detailed, beautiful face, CG unity 8k wallpaper, detailed and intricate, original,highres,\\ nsfw,show nipples,A fashionably dressed girl wearing sunglasses, jacket,jeans,(Stand in a very high and dangerous place,Extreme selfie:1.5),a bird’s-eye view,(tattoo:1.2),(thrilled expressions,excited expressions),black hair,// , girls focus, solo, from above, standing,// realistic:1.3, (ambient light:1.3),(cinematic composition:1.3),(neon lights:0.1),(HDR:1),Accent Lighting, pureerosface_v1:1
Деревня
sharp details, a medieval village in switzerland, mess jungle in background, ornate, beautiful, atmosphere, vibe, flowers, concept art illustration, greg rutowski, volumetric lighting, sunbeams, particles, colorful clothes, by Jean-Baptiste Monge, Gilles Beloeil, Tyler Edlin, Marek Okon, Pixar, album art, comic style, golden ratio, perfect composition, a masterpiece, trending on artstation, oversaturated, epic realistic, hdr, intricate details, rutkowski, intricate, cinematic, detailed
Портрет под арт (близко к аниме 3д)
highly detailed portrait of halo, blue eyes, tartan scarf, white hair by atey ghailan, by greg rutkowski, by greg tocchini, by james gilleard, by joe fenton, by kaethe butcher, gradient yellow, black, brown and magenta color scheme, grunge aesthetic!!! graffiti tag wall background
Портрет под арт
a 21 years old (european:1.3) devil girl with wild black hair with red braids| centered| key visual| intricate| highly detailed| breathtaking beauty| precise lineart| vibrant| comprehensive cinematic| Carne Griffiths| Conrad Roset
Портрет под арт 2
Ultra-detailed woman, (looking thoughtfully into the distance:1.4), in the park, sitting on a bench, full body, outdoors, (not looking at the camera:1.7), (adjusting hair:1.5), (short open shirt:1.2), solo, beautiful detailed sky, (closed mouth), small breasts, beautiful detailed eyes, floating hair, NSFW, seminude bosom, saliva, style-empire, by Alex Huguet, Mike Hill, Ian Spriggs, JaeCheol Park, Marek Denko, picture painted in impressionist style, brushstroke painting technique, palette knife painting, an expressive oil painting, Leonid Afremov
Портрет залитый краской
(level difference:1.8),(Paint colliding and splashing on the canvas),(depth of field),1girl’s side face blends into it,((side face)),open mouth,(liquid paint rainbow hair:1.1) made of paint and defies gravity,thick flowing,(paint splatter:1.3),Liquid state,stunningly beautiful, masterpiece, detailed background,ultra high quality model, ethereal background,abstract beauty, explosive volumetric, oil painting,heavy strokes,Romantic lighting,Sub-Surface Scatterring,lens 135mm,f1.8,glow,8k,high resolution, dreamy,ray tracing,hdr,god rays
Портрет под векторный арт
vector art, artwork by Ilya Kuvshinov, artwork by WLOP, detail vector art, loose brush effect, luminance, warm bright pastel colors, perfect hips, Riuko Matoi stretching, luminous, warm copper hair, pale, blue eyes, vector art, hazed out, artwork by Ilya Kuvshinov, bright orange-pink car show background
Портрет под векторный арт 2 (+ clip skip = 2)
masterpiece, best quality, ( art by acrylic pouring | warm bright pastel colors | 2d minialist vector illustration |), 1gril, beautiful woman, smile, portrait, bright background
Портрет под векторный арт 3 (+ clip skip = 2)
masterpiece, best quality, (2d minimalist vector illustration), 1girl, beautiful woman, closed eyes, colorful, (Gustav Klimt blends blue color long hair), (Wassily Kandinsky blends dress:1.2), (acrylic pour art blends background:1.4), (bust shot:1.4)
Портрет мужчины под арт
portrait of the man, stunning, highly detailed, 8k, ornate, intricate, cinematic, dehazed, atmospheric, (oil painting:0.75), (splash art:0.75),(teal:0.2),(orange:0.2), (by Jeremy Mann:0.5), (by John Constable:0.1),(by El Greco:0.5),(acrylic paint:0.75)
Стикеры (+ )
robocop ((stickers)) retro (high quality)
Чернила (+ )
The eagle stood on the branch, traditional chinese ink painting
Карта тарро
70s style poster art, cosmic galactic style art, Tarot card: «III — The Empress» Gorgeous poster art textured and aesthetic
Детский рисунок
Jinx fanart, drawn by a 5-year-old child with colored cranyon
Двойная экспозиция (пейзаж в персонаже)
Double exposure, Midjourney style, merging, blending, overlay double exposure image, Double Exposure style, An exceptional masterpiece by Yukisakura revealing a fantastic double exposure composition of Naruto body silhouette harmoniously intertwined with the visually striking details of the hidden leaf village towards a sunset over the mountains. While the sunset and mountains details are outwardly echoing through the fabric of the figure, beautiful tension climbs as the contrasting use of monochrome in the background maintains razor-sharp focus on the remarkable double exposure image. Characterized by its vibrant full-color scheme and crisp lines that shadow the contours just as meticulously. (Detailed:1.45). (Detailed background:1.4).
Экшн фигурка
Product photography:
Plastic full-body action figure of Tom Cruise as Major William Cage from Edge of Tomorrow. The figure stands upright in full exo-suit armor, battle-worn and detailed with grime, scratches, and bullet marks. Face sculpt features a determined expression mid-loop, with tousled helmet hair and a subtle five o’clock shadow.
“Live. Die. Repeat. Collection”
«Major William Cage Action Figure» – matte black packaging with electric blue typography and yellow hazard stripes. The box looks slightly scorched, like it’s survived one too many dropship landings.
The figure and accessories are sealed in heavy-duty molded plastic.
3 accessories on the left, 1 plastic Cage action figure on the right.
Accessories:
Pulse Rifle
Grenade Belt
Battle Helmet
(in a red spikey bubble below the accessories):
«Now with Built-In Voice Module!» :
“I think there’s something wrong with your suit. There’s a dead guy in it.”
«Did you just take my battery pack?»
«I wish I didn’t know you, but I do.»
Captured using a Sony mirrorless camera with a 70-200mm f2.8 lens, cinematic lighting for a gritty sci-fi vibe, showing micro-detail in the suit’s hydraulic pistons and weathering. Background: steel-gray with smoky atmosphere, mimicking the battlefield of Verdun.
Негативные промты
1.
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
2.
bad-artist, bad-hands-5, ugly, duplicate, censored, morbid, mutiliated, extra digits, bad hands, mutiliated hands, poorly drawn face, poorly drawn hands, mutation, deformed, blurry, bad anatomy, extra limbs, cloned face, gross proportions, malformed, missing arms, missing legs, mutated hands, low quality, lowres, normal quality, worst quality, standard quality, watermark, jpeg artifacts, weird eyes, plain background
3.
easynegative, (worst quality, low quality:1.4), watermark, logo, bad anatomy, extra fingers, extra hands, body hair, mosaic
4.
(worst quality, low quality, normal quality, lowres, low details, oversaturated, undersaturated, overexposed, underexposed, grayscale, bw, bad photo, bad photography, bad art:1.4), (watermark, signature, text font, username, error, logo, words, letters, digits, autograph, trademark, name:1.2), (blur, blurry, grainy), morbid, ugly, asymmetrical, mutated malformed, mutilated, poorly lit, bad shadow, draft, cropped, out of frame, cut off, censored, jpeg artifacts, out of focus, glitch, duplicate, (airbrushed, cartoon, anime, semi-realistic, cgi, render, blender, digital art, manga, amateur:1.3), (3D ,3D Game, 3D Game Scene, 3D Character:1.1), (bad hands, bad anatomy, bad body, bad face, bad teeth, bad arms, bad legs, deformities:1.3)
Настройки
Семплер: DPM++ 2M Karras, Euler a (не естественная кожа у людей), UniPC (новый, потестить)
Restore faces — снять галку
GFG = 7 (4-12) (чем выше, тем больше деталей дорисовывается, большие значения — пережжённое и пластиковое изображение, на фотографиях ставить 4.5)
Sampling steps = 28
Mimic CFG Scale — 6 (CFG Scale = 12, Clip skip = 1)
Если без Mimic CFG — Clip skip = 2
User interface — Quicksettings list — sd_model_checkpoint,sd_vae,CLIP_stop_at_last_layers
Face restoration (лучше отключать)
Code former = 0.6
live preview = 10
Multiplier for extra networks = 0.7
Vae
https://huggingface.co/stabilityai/sd-vae-ft-mse-original/tree/main
COMFYUI
https://github.com/comfyanonymous/ComfyUI?tab=readme-ov-file
Обновить
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\update\update_comfyui.bat
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\update\update_comfyui_and_python_dependencies.bat
Запуск
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\run_nvidia_gpu.bat
Модели класть в:
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\models\checkpoints
Чтобы ссылаться на модели:
(Для скорости — хранить все модели на ссд)
https://schinagl.priv.at/nt/hardlinkshellext/HardLinkShellExt_X64.exe
ПКМ — Запомнить источник ссылки
ПКМ — Поместить как… — Символическую ссылку
Включить режим разработчика (чтобы был доступен save API):
Шестерня — Enable Dev mode Options
Чтобы «изменения» в нодах действовали сразу:
Шестерня — Widget Value Control Mode — before
Менеджер:
https://github.com/ltdrdata/ComfyUI-Manager
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes
в адресной строке — cmd
git clone https://github.com/Comfy-Org/ComfyUI-Manager.git
Если появляется предупреждение:
"Legacy ComfyUI-Manager data backup exists. Please verify and remove when no longer needed. See terminal for details."
Удалить C:\ComfyUI\ComfyUI_windows_portable\ComfyUI\user\__manager\.legacy-manager-backup
Чтобы видеть какие ноды свои:
Lite Graph - Node source badge mode
Lite Graph - Node ID badge mode
Чтобы сделать прямые линии:
Шестерня(settings) - Lite Graph - Link Render Mode - Straight
Мониторинг ресурсов:
Crystools из менеджера или
https://github.com/crystian/ComfyUI-Crystools
Clone this repo into custom_modules:
cd ComfyUI/custom_nodes
git clone https://github.com/crystian/ComfyUI-Crystools.git
cd ComfyUI-Crystools
pip install -r requirements.txt
Горячие клавиши:
2 ЛКМ — поиск по вставке ноды
CTRL + B — деактивировать/активировать ноду
CTRL + стрелка вверх\вниз — усилить\ослабить промт
CTRL + SHIFT + V — вставить с добавленными связями
Использовать 2 GPU:
https://github.com/neuratech-ai/ComfyUI-MultiGPU
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes>git clone https://github.com/neuratech-ai/ComfyUI-MultiGPU.git
Переключить на 2ю GPU:
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy\cli_args.py
parser.add_argument(«—cuda-device», type=int, default=1, metavar=»DEVICE_ID», help=»Set the id of the cuda device this instance will use.»)
Выражения лица онлайн:
https://github.com/kijai/ComfyUI-LivePortraitKJ/tree/main/examples
Controlnet:
ComfyUI-Advanced-ControlNet
ComfyUI’s ControlNet Auxiliary Preprocessors
Скачать модели:
https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main
Поместить модели:
ComfyUI\models\controlnet
Для XL:
lineart — https://huggingface.co/promeai/sdxl-controlnet-lineart-promeai/tree/main
canny — https://huggingface.co/diffusers/controlnet-canny-sdxl-1.0/tree/main
Скачать diffusion_pytorch_model.safetensors и переименовать в controlnet-canny-sdxl-1.0.safetensors
Лоры:
https://huggingface.co/stabilityai/control-lora/tree/main/control-LoRAs-rank256
IPadapter:
ComfyUI_IPAdapter_plus
Скачать модели:
https://github.com/cubiq/ComfyUI_IPAdapter_plus/
Поместить модели:
/ComfyUI/models/clip_vision
/ComfyUI/models/ipadapter
Blip:
Скачать — https://huggingface.co/Rookiehan/BLIP/tree/main
положить в ComfyUI\models\BLIP
Обновить torch (если какой-то мод всё сломал):
Из папки ComfyUI_windows_portable\python_embeded
.\python.exe .\Scripts\pip.exe install —upgrade —force-reinstall torch torchvision torchaudio —index-url https://download.pytorch.org/whl/cu121
Florence (картинка в текст):
https://huggingface.co/microsoft/Florence-2-base
Ставить в C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\models\LLM
git clone https://huggingface.co/microsoft/Florence-2-base
Из https://huggingface.co/microsoft/Florence-2-base/tree/main скачиваем pytorch_model.bin и кладём в Florence-2-base
Janus-Pro:
В менеджере ComfyUI-Janus-Pro
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\janus-pro -> запустить cmd -> pip install -r requirements.txt
Скачать модель (7B)
https://huggingface.co/deepseek-ai/Janus-Pro-7B/tree/main
переместить всё в папку
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\models\Janus-Pro\Janus-Pro-7B
llama.ccp
Добавить ноду
G:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_LlamaCpp_8085
файл __init__.py
import json
import urllib.error
import urllib.request
DEFAULT_SERVER_URL = "http://127.0.0.1:8085"
class LlamaCppPrompt:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"prompt": (
"STRING",
{
"multiline": True,
"default": "Write a short image prompt for a quiet cyberpunk street at night.",
},
),
},
"optional": {
"system_prompt": (
"STRING",
{
"multiline": True,
"default": "",
},
),
"server_url": (
"STRING",
{
"default": DEFAULT_SERVER_URL,
},
),
"api_mode": (
[
"Auto",
"OpenAI chat",
"llama.cpp completion",
],
{
"default": "Auto",
},
),
"model": (
"STRING",
{
"default": "local",
},
),
"temperature": (
"FLOAT",
{
"default": 0.7,
"min": 0.0,
"max": 2.0,
"step": 0.05,
},
),
"top_p": (
"FLOAT",
{
"default": 0.9,
"min": 0.0,
"max": 1.0,
"step": 0.01,
},
),
"max_tokens": (
"INT",
{
"default": 512,
"min": 1,
"max": 8192,
"step": 1,
},
),
"seed": (
"INT",
{
"default": -1,
"min": -1,
"max": 2147483647,
"step": 1,
},
),
"stop": (
"STRING",
{
"multiline": True,
"default": "",
},
),
"timeout_seconds": (
"INT",
{
"default": 120,
"min": 1,
"max": 600,
"step": 1,
},
),
},
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("text",)
FUNCTION = "generate"
CATEGORY = "llama.cpp"
def generate(
self,
prompt,
system_prompt="",
server_url=DEFAULT_SERVER_URL,
api_mode="Auto",
model="local",
temperature=0.7,
top_p=0.9,
max_tokens=512,
seed=-1,
stop="",
timeout_seconds=120,
):
server_url = server_url.rstrip("/")
stop_values = self._parse_stop(stop)
if api_mode == "Auto":
try:
result = self._call_openai_chat(
server_url=server_url,
prompt=prompt,
system_prompt=system_prompt,
model=model,
temperature=temperature,
top_p=top_p,
max_tokens=max_tokens,
seed=seed,
stop_values=stop_values,
timeout_seconds=timeout_seconds,
)
if result[0].strip():
return result
except RuntimeError as exc:
if "HTTP 404" not in str(exc):
raise
return self._call_llamacpp_completion(
server_url=server_url,
prompt=prompt,
system_prompt=system_prompt,
temperature=temperature,
top_p=top_p,
max_tokens=max_tokens,
seed=seed,
stop_values=stop_values,
timeout_seconds=timeout_seconds,
)
if api_mode == "OpenAI chat":
return self._call_openai_chat(
server_url=server_url,
prompt=prompt,
system_prompt=system_prompt,
model=model,
temperature=temperature,
top_p=top_p,
max_tokens=max_tokens,
seed=seed,
stop_values=stop_values,
timeout_seconds=timeout_seconds,
)
return self._call_llamacpp_completion(
server_url=server_url,
prompt=prompt,
system_prompt=system_prompt,
temperature=temperature,
top_p=top_p,
max_tokens=max_tokens,
seed=seed,
stop_values=stop_values,
timeout_seconds=timeout_seconds,
)
def _call_openai_chat(
self,
server_url,
prompt,
system_prompt,
model,
temperature,
top_p,
max_tokens,
seed,
stop_values,
timeout_seconds,
):
url = f"{server_url}/v1/chat/completions"
payload = self._chat_payload(
prompt=prompt,
system_prompt=system_prompt,
model=model,
temperature=temperature,
top_p=top_p,
max_tokens=max_tokens,
seed=seed,
stop_values=stop_values,
)
data = self._post_json(url, payload, timeout_seconds)
return (self._clean_text(self._read_chat_text(data)),)
def _call_llamacpp_completion(
self,
server_url,
prompt,
system_prompt,
temperature,
top_p,
max_tokens,
seed,
stop_values,
timeout_seconds,
):
url = f"{server_url}/completion"
payload = self._completion_payload(
prompt=prompt,
system_prompt=system_prompt,
temperature=temperature,
top_p=top_p,
max_tokens=max_tokens,
seed=seed,
stop_values=stop_values,
)
data = self._post_json(url, payload, timeout_seconds)
return (self._clean_text(self._read_completion_text(data)),)
@staticmethod
def _parse_stop(stop):
values = [line.strip() for line in stop.splitlines() if line.strip()]
return values or None
@staticmethod
def _clean_text(text):
return text.strip()
@staticmethod
def _chat_payload(
prompt,
system_prompt,
model,
temperature,
top_p,
max_tokens,
seed,
stop_values,
):
messages = []
if system_prompt.strip():
messages.append({"role": "system", "content": system_prompt})
messages.append({"role": "user", "content": prompt})
payload = {
"model": model or "local",
"messages": messages,
"temperature": temperature,
"top_p": top_p,
"max_tokens": max_tokens,
"stream": False,
}
if seed >= 0:
payload["seed"] = seed
if stop_values:
payload["stop"] = stop_values
return payload
@staticmethod
def _completion_payload(
prompt,
system_prompt,
temperature,
top_p,
max_tokens,
seed,
stop_values,
):
full_prompt = prompt
if system_prompt.strip():
full_prompt = f"{system_prompt.strip()}\n\n{prompt}"
payload = {
"prompt": full_prompt,
"temperature": temperature,
"top_p": top_p,
"n_predict": max_tokens,
"stream": False,
}
if seed >= 0:
payload["seed"] = seed
if stop_values:
payload["stop"] = stop_values
return payload
@staticmethod
def _post_json(url, payload, timeout_seconds):
body = json.dumps(payload).encode("utf-8")
request = urllib.request.Request(
url,
data=body,
headers={
"Content-Type": "application/json",
"Accept": "application/json",
},
method="POST",
)
try:
with urllib.request.urlopen(request, timeout=timeout_seconds) as response:
raw = response.read().decode("utf-8")
except urllib.error.HTTPError as exc:
detail = exc.read().decode("utf-8", errors="replace")
raise RuntimeError(f"llama.cpp request failed with HTTP {exc.code}: {detail}") from exc
except urllib.error.URLError as exc:
raise RuntimeError(f"Could not connect to llama.cpp at {url}: {exc.reason}") from exc
try:
return json.loads(raw)
except json.JSONDecodeError as exc:
raise RuntimeError(f"llama.cpp returned invalid JSON: {raw[:500]}") from exc
@staticmethod
def _read_chat_text(data):
choices = data.get("choices") or []
if choices:
message = choices[0].get("message") or {}
content = message.get("content")
if content is not None:
return content
text = choices[0].get("text")
if text is not None:
return text
raise RuntimeError(f"Could not read chat text from llama.cpp response: {data}")
@staticmethod
def _read_completion_text(data):
content = data.get("content")
if content is not None:
return content
choices = data.get("choices") or []
if choices:
text = choices[0].get("text")
if text is not None:
return text
raise RuntimeError(f"Could not read completion text from llama.cpp response: {data}")
NODE_CLASS_MAPPINGS = {
"LlamaCppPrompt": LlamaCppPrompt,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"LlamaCppPrompt": "Llama.cpp Prompt",
}
Остановить процесс
Get-CimInstance Win32_Process |
Where-Object {
$_.ExecutablePath -eq 'G:\ComfyUI\ComfyUI_windows_portable\python_embeded\python.exe' -and
$_.CommandLine -like '*ComfyUI\main.py*'
} |
ForEach-Object { Stop-Process -Id $_.ProcessId }
Воркфлоу автоматически сохраняется в:
G:\ComfyUI\ComfyUI_windows_portable\ComfyUI\user\default\workflows
Flux
Для clip (декодирование промта)
https://huggingface.co/comfyanonymous/flux_text_encoders/tree/main
clip в C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\models\clip
Модели
https://huggingface.co/Kijai/flux-fp8/tree/main
Кладём модель в
C:\ConfUI\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\models\unet
Для schnell оптимально 4 шага https://huggingface.co/black-forest-labs/FLUX.1-schnell/tree/main
Для dev оптимально 30 шагов https://huggingface.co/black-forest-labs/FLUX.1-dev/tree/main
Vae
https://huggingface.co/black-forest-labs/FLUX.1-schnell/tree/main/vae
https://huggingface.co/black-forest-labs/FLUX.1-dev/tree/main/vae
Сжатая модель
https://huggingface.co/city96/FLUX.1-dev-gguf/tree/main
Энкодер (clip) для сжатой модели
https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/tree/main
Полезные ссылки
Текст обрамлённой картинкой
https://ideogram.ai/
Скрытый в картинке текст
https://replicable.art/learn/generate-images-with-hidden-text-using-stable-diffusion-and-controlnet
Аналог chatGPT (US and UK)
https://claude.ai/
Растровую в векторную графику
https://vectorizer.ai/
Генератор скайбокса
https://skybox.blockadelabs.com/
Варианты одного изображения
https://imagevariations.com/
Генератор музыки
https://app.songr.ai/
Топ-новости отобранные ии
https://www.newsminimalist.com/
Топовые модели для сравнения
https://yupp.ai/
Нарисуй обложку для статей по "Postgresql" как скетч с цветными зарисовками в разрешении 1:1
Текст на обложку не добавляй.
На белом фоне. Минимальные отступы от изображения по бокам.
Комментарии
Комментариев пока нет.
Чтобы оставлять комментарии, войдите или зарегистрируйтесь.