Comfyui-Z-Image-Utilities ローカルLLMでプロンプトを拡張
以前にも、ローカルLLMを使ってプロンプトを拡張することをやってみていましたが、Z-Imageでも専用のノードもあるようなので試してみました。
Z-Imageのプロンプト拡張ノードはこちらです。
ワークフローも置いてあります。

ローカルで動かしたいので、Comfyui_Z_Image_Prompt_Enhancher_Local.json をとってきます。
ComfyUIにポイっとすると、不足カスタムノードが赤くなりますが、Managerから取ってこれます。

1つずつノードを見てみます。

ローカルでollamaを使おうと思いますが、

GitHubのサイトにこう書かれているので、ノードの設定はこのままで良さそうです。モデルが無いので取ってきておきます。
> ollama pull huihui_ai/qwen3-abliterated:latest
Z-Imageのモデルを見てみます。

fp8になっています。fp8を取ってきてもいいですが、うちはbf16がダウンロード済みなので、それに変更します。weightはfp8_e4m3fnのままにしておきます。その方が軽そうなので。

オプションも見てみます。

よく解らん。このままでいいわ。
さて、メインのプロンプト拡張ノードです。

prompt_templateがchineseになっていて、プロンプトにも中国語が書かれています。englishに変更して、適当なものを入れてみます。

サンプラーを見てます。

Stepsが10ですね。4でいいかな。サイズも大きすぎるので、1024×1280くらいにしてみよう。

よし、これでいいかな。元のプロンプトは「a girl, cyberpunk, portrait」です。
やってみよう。

は?
なんか思ってたのと違う。
生成されたプロンプトを見てみよう。
a girl in a cyberpunk portrait, featuring a close-up of her face with detailed cybernetic enhancements, neon-lit cityscape in the background, holographic displays, metallic textures, and vibrant color scheme with dark tones, high contrast lighting, and digital effects. "girl cyberpunk portrait"
まぁ、このプロンプトならそうか。
もう一回やってみよう。

おー、なんかカッコいいのが出てきた。
プロンプトを見てみよう。
a girl, cyberpunk style, portrait. the subject is a young woman with pale skin, dark hair styled in a high-tech bob, and cybernetic enhancements visible in her left eye and wrist. she wears a form-fitting black bodysuit with glowing blue circuit patterns, a holographic collar, and a neon-green jacket with LED accents. the background features a dystopian cityscape at night, with towering skyscrapers, neon signs, and rain effects. the lighting is dramatic, with intense neon highlights on her face and the city, casting sharp shadows. the atmosphere is layered with digital static and faint holographic projections in the air.
プロンプト拡張をしなかったらどんな感じかみてみようか。

おい、こっちの方がいいじゃないか。
いや、まぁ、何をもっていいとするかってことではあるけど。
プロンプト拡張をもう一回やってみよう。

うーん。
プロンプトは?
a girl in a cyberpunk portrait, featuring a close-up of her face with glowing neon circuit patterns on her skin, high-tech eyewear with a digital interface, vibrant electric blue and magenta highlights, background elements of a dystopian cityscape with holographic signs and rain effects, cinematic lighting with deep shadows and accentuated neon reflections, detailed metallic textures on her outfit, and a dynamic composition focusing on her determined expression with subtle digital glitches in the atmosphere. "Cybernetic enhancements visible on her arms, neon-lit street signs in the background, rain droplets with light refraction, holographic advertisements, and a faint glow from distant skyscrapers."
メガネいらんなぁ。
アニメスタイルもやってみよう。
「anime style, a girl, cyberpunk, portrait」で

アニメというか、3D寄りですね。悪くないけど。
プロンプトは、
a girl in anime style, cyberpunk aesthetic, portrait composition. detailed facial features with expressive eyes and dynamic hair. neon lighting effects, holographic elements, and circuit pattern accents. dark background with glowing cityscape elements. vibrant color palette featuring electric blue, purple, and pink tones. high contrast lighting with subtle glows and reflections. intricate clothing design blending fashion and technology. layered depth with foreground focus on the girl's face and upper body.
もう一回。

アニメ調にならんね。LoRAがいるか。
プロンプトは、
a girl in a cyberpunk anime portrait, featuring intricate cybernetic enhancements on her arms and neck, glowing neon-blue circuit patterns along her black-and-silver outfit, dramatic chiaroscuro lighting with deep shadows and vibrant light streaks, background elements include a futuristic cityscape with holographic billboards and floating vehicles, her expression is focused and determined, eyes with iridescent digital effects, composition centered on her face with dynamic perspective, color palette dominated by electric blue, purple, and silver with contrasting dark tones, detailed metallic textures on her attire and accessories, subtle digital haze in the atmosphere, no text elements.
これもプロンプト拡張無しもやってみよう。
「anime style, a girl, cyberpunk, portrait」

なんか、普通にいいじゃないか。
LLMのモデルのセンスがいまいちなのかな。
モデルをphi4に変えてみよう。

どうかな。

お、おー。これはまた斬新な。
プロンプトを見てみよう。
An anime-style portrait of a girl set in a cyberpunk environment features a young woman with exaggerated, expressive eyes and slightly elongated ears, characteristic of the genre. Her hair is styled in vibrant streaks of neon blue and electric pink, contrasting with her deep black roots. A high-tech visor with glowing circuit patterns overlays one eye, hinting at augmented reality features. Her attire consists of a sleek, form-fitting jacket made from reflective materials that shimmer under the ambient city lights, complemented by a utility belt equipped with futuristic gadgets. Below, she wears holographic leggings that shift colors subtly as they catch different angles of light. Her posture is confident yet slightly informal, leaning forward with one hand casually resting on her hip while the other holds an advanced data pad displaying complex code. The background exudes a cyberpunk atmosphere: towering skyscrapers adorned with cascading digital billboards emit pulses of neon advertisements and information streams. The cityscape blends industrial grays with bursts of electric colors, creating a dynamic backdrop that reflects off rain-slicked streets. A faint glow from the horizon suggests an ever-present urban night. The composition focuses on her face, capturing intricate details like the glowing circuits in her visor and the subtle interplay of light across her skin. The overall color scheme emphasizes contrasts between dark, muted tones and vivid neon highlights. Textural elements include the smooth, metallic surfaces of her attire and accessories, against which the softness of her skin stands out. No text is included on her person or in the immediate surroundings; instead, the environment communicates through its vibrant visual language, embodying a world where technology seamlessly integrates with daily life.
ながっ。
モデルをgpt-ossにしたらどうかな。

いってみよう。

アニメにならんな。いい感じだけど。
プロンプトはどうかな。
anime style portrait of a teenage girl with short silver hair, cyberpunk aesthetic, wearing a neon‑lit jacket with glowing circuitry patterns, cybernetic arm with chrome plating, standing in a rain‑soaked neon alley, reflected holographic signs in pink and blue, dramatic backlit neon lights, moody atmosphere, high detail, sharp focus, realistic textures, subtle glow effects, cinematic lighting.
おー、シンプル。
もう一回やってみよ。

ちょっとアニメ寄りになった。
プロンプトは、
portrait of a young woman in anime style, cyberpunk theme, close‑up head and shoulders, sharp line work and smooth shading, expressive eyes, short silver hair with neon blue streaks, pale skin with a faint digital tattoo on the neck, wearing a fitted cybernetic jacket with glowing circuitry, subtle holographic overlay on her left ear, background of a dimly lit cityscape with towering neon signs in pink and purple, blurred rain streaks, ambient neon glow reflecting off wet surfaces, lighting emphasizes cool blue and magenta tones, high detail.
版権キャラはいけるかやってみよう。
「anime style, a girl, asuka from evangelion」
どうかな。

まんまやん。いや、だいぶシンジか。
プロンプトは?
anime style illustration of a teenage girl with bright orange hair, styled in a short, slightly wavy cut that falls just below the ears. She has sharp, expressive brown eyes and a confident, determined expression. She is wearing the iconic red and black pilot suit from the Evangelion series: a form-fitting, sleeveless top with a white collar, black tactical gloves, and a matching black pants that taper to the knees. The suit is detailed with a red emblem on the chest, black zipper details along the front, and subtle shading to suggest fabric texture and muscle definition. She stands in a dynamic pose, slightly angled to the left, one hand resting on the steering column of a sleek, futuristic cockpit, the other hand gripping a control lever. The background is a stylized cockpit interior with glowing control panels, illuminated by a soft blue light that casts subtle highlights on her face and outfit. The overall color palette emphasizes the contrast between the vibrant red of the suit, the deep black of the details, and the cool blue ambient lighting. The lighting creates a dramatic play of light and shadow, highlighting the sharp angles of the cockpit and the contours of the figure. The atmosphere feels tense and focused, with a subtle hint of motion blur in the background panels to convey speed.
プロンプトの中に、asukaの文字が見当たらないのにすごいね。
そもそも、拡張無しでも出るんだっけ?
やってみよう。

まぁいろいろ違うけど、まぁ大体理解はしているってことか。
ってことは、LLMも理解していて、上手く保管してくれたって考えていいのかな。
じゃあ、こんなのは。
「anime style, a girl, shinobu from kimetsu no yaiba」
どう?

まぁ、炭治郎ですね。
これを、拡張してやってみよう。

あー、LLMが理解していないのか。
プロンプトを見てみよう。
Anime style illustration of Shinobu Kocho from Kimetsu no Yaiba. She has long, straight white hair tied with a green ribbon, pale blue eyes, and a calm expression. She wears her signature green and white kimono with delicate butterfly motifs embroidered in silver thread. The kimono is tailored with a high collar and flowing sleeves, the fabric appearing slightly translucent in the light. She holds a slender curved demon‑slaying sword in her right hand, the blade catching the light with a subtle silver sheen. The background is a tranquil forest scene with tall trees, dappled sunlight filtering through the canopy, creating soft shadows on the forest floor. The overall color palette is vibrant yet muted, with greens, whites, and soft gold highlights, and the lighting is natural, casting gentle highlights and soft shadows to emphasize the detailed textures of her clothing and hair.
あまり理解してないね。
固有名詞を指定してもダメなら、これはZ-Imageも理解していないってことかな。
ちなみに、ChatGPTにプロンプトを拡張させてみよう。
画像が生成できるようにプロンプトを拡張して。
anime style, a girl, shinobu from kimetsu no yaiba
以下は、画像生成向けに具体性と描写力を高めた拡張プロンプトです。
(そのまま使える形+調整しやすいように要素を盛り込んでいます)
Expanded Prompt(英語)
Anime style illustration of Shinobu Kocho from Kimetsu no Yaiba, a beautiful young girl with a calm and mysterious smile. She has short wavy purple hair with butterfly-shaped hairpin, gentle yet piercing purple eyes, and a slender, graceful figure. She is wearing her Demon Slayer Corps uniform with a butterfly-patterned haori, flowing softly in the wind.
The scene is set in a moonlit wisteria garden, with glowing purple flowers and floating petals around her. Soft lighting, ethereal atmosphere, pastel color palette, high detail, clean lineart, smooth shading, cinematic composition.
Ultra high quality, anime key visual, detailed face, expressive eyes, dynamic pose, shallow depth of field, 4k illustration, studio anime style.
これでやってみよう。

胡蝶炭治郎が出来ました。
ではまた。
