NETA_LUMINA
Collection
4 items
•
Updated
•
4
基于Lumina2的动漫风格图像生成模型 | Anime-style Image Generation Model based on Lumina2
pip install diffusers transformers torch accelerate
import torch
from diffusers import Lumina2Pipeline
# 加载模型 | Load the model
pipe = Lumina2Pipeline.from_pretrained("neta-art/Neta-Lumina-diffusers", torch_dtype=torch.bfloat16)
# 启用模型CPU卸载以节省显存 | Enable model CPU offloading to save VRAM
pipe.enable_model_cpu_offload() # Remove this if you have sufficient GPU memory
# 定义提示词 | Define prompts
prompt = "You are an assistant designed to generate anime images based on textual prompts. <Prompt Start> 1girl, beautiful, detailed, high quality"
negative_prompt = "You are an assistant designed to generate images based on textual prompts. <Prompt Start> A low quality, low resolution, ugly, and disgusting image with severe digital artifacts, blur, and noise. The subject is deformed, disfigured, and malformed, with bad anatomy, mutated limbs, and bad proportions. Features distorted, twisted, and unnatural hands and face, with extra or missing fingers. The style is amateurish, poorly drawn, childish, like a flat, unfinished sketch or a cheap, bad CGI render. The composition is bad, cropped, out of frame, and cluttered with text, watermarks, or signatures,"
# 生成图像 | Generate image
image = pipe(
prompt,
height=1024,
width=1024,
guidance_scale=5, # 增加引导比例以获得更好的提示词遵循 | Increase guidance scale for better prompt adherence
num_inference_steps=50, # 增加推理步数以获得更好的质量 | Increase inference steps for better quality
negative_prompt=negative_prompt,
generator=torch.Generator("cpu").manual_seed(114514)
).images[0]
# 保存图像 | Save the image
image.save("neta-lumina-output.png")
⚠️ 性能提示 | Performance Note: 目前diffusers对默认Lumina2采样器的支持效果不如ComfyUI。如需体验最佳生成效果,建议使用ComfyUI。
⚠️ Performance Note: Currently, diffusers' support for the default Lumina2 sampler doesn't match the generation quality of ComfyUI. For the best generation experience, we recommend using ComfyUI.
Apache 2.0