結果
一番左がNegative Promptなし
真ん中がunaestheticXL AYv1を使った場合
一番右がunaestheticXL v3.1を使った場合
使い方
from safetensors.torch import load_file state_dict = load_file("embeddings/unaestheticXLv31.safetensors") pipe.load_textual_inversion( state_dict["clip_g"], token="unaestheticXLv31", text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2) pipe.load_textual_inversion( state_dict["clip_l"], token="unaestheticXLv31", text_encoder=pipe.text_encoder, tokenizer=pipe.tokenizer)
全体のPythonスクリプト
モデルとしてCounterfeitXL v1.0を使いました。Textual InversionとしてunaestheticXL AYv1 と v3.1を使いました。
from diffusers import StableDiffusionXLPipeline from safetensors.torch import load_file import torch pipe = StableDiffusionXLPipeline.from_single_file( "safetensors/counterfeitxl_v10.safetensors", load_safety_checker=False, extract_ema=True, torch_dtype=torch.float16 ).to("cuda") state_dict = load_file("embeddings/unaestheticXL_AYv1.safetensors") pipe.load_textual_inversion( state_dict["clip_g"], token="unaestheticXL_AYv1", text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2) pipe.load_textual_inversion( state_dict["clip_l"], token="unaestheticXL_AYv1", text_encoder=pipe.text_encoder, tokenizer=pipe.tokenizer) prompt = "absurdres, highres, ultra detailed, super fine illustration, japanese anime style, solo, 1girl, 18yo, an extremely cute and beautiful girl, highly detailed beautiful face and eyes,thigh up, fountain background, from side" negative_prompt = "unaestheticXL_AYv1" seed = 10000 generator = torch.manual_seed(seed) image = pipe( prompt=prompt, negative_prompt=negative_prompt, generator=generator).images[0] image.save("unaestheticXL_AYv1.png")