🚀 FLUX-Hyperscale-fused-fast (schnell)
diffusers
库助力的文本到图像生成模型,可基于输入的文本描述快速生成高质量的图像,适用于各种图像创作场景。
🚀 快速开始
环境准备
确保你已经安装了torch
和diffusers
库。
代码示例
以下是使用diffusers
库生成图像的示例代码:
import torch
from diffusers import AutoPipelineForText2Image
pipe = AutoPipelineForText2Image.from_pretrained("minpeter/FLUX-Hyperscale-fused-fast", torch_dtype=torch.bfloat16).to("cuda")
prompt = "orange tabby cat, curled up asleep, peaceful expression, lying in a warm patch of sunlight, on a cozy living room rug, warm lighting, soft focus background"
image = pipe(
prompt=prompt,
guidance_scale=0.0,
height=1024,
width=1024,
num_inference_steps=4,
).images[0]
image.save("output.png")
代码解释
- 导入必要的库:导入
torch
和diffusers
库中的AutoPipelineForText2Image
类。
- 加载预训练模型:使用
from_pretrained
方法加载预训练的文本到图像生成模型,并将其移动到GPU上。
- 定义提示文本:定义一个描述图像内容的提示文本。
- 生成图像:使用
pipe
对象生成图像,并设置相关参数,如guidance_scale
、height
、width
和num_inference_steps
。
- 保存图像:将生成的图像保存为
output.png
文件。
✨ 主要特性
- 多领域图像生成:支持文本到图像的生成,涵盖复古汽车、动漫场景、太空宇航员等多种领域。
- 高质量图像输出:生成的图像具有超详细、逼真的金属纹理、史诗般的视觉效果和照片级的质感。
- 快速推理:通过优化的模型架构和推理流程,实现快速的图像生成。
📦 模型信息
属性 |
详情 |
库名称 |
diffusers |
基础模型 |
black-forest-labs/FLUX.1-schnell |
新版本 |
minpeter/FLUX-Hyperscale-fused |
许可证 |
apache-2.0 |
标签 |
text-to-image、image-generation、flux |
📚 示例展示
示例1
- 提示文本:A nostalgically crafted relic of the past, a meticulously restored deep bronze pearlescent classic 60's muscle car cruises through the dusk streets with an intimidating elegance. The vintage vehicle gleams with a lustrous sheen, showcasing its aerodynamic lines and sharp accents as it cruises along the asphalt. This evocative scene is captured in a vividly detailed oil painting, where every brushstroke highlights the car's classic styling and pristine condition. Impeccably rendered, this image transports viewers to a bygone era of automotive luxury and style. ultra detailed, masterpiece,epic,photorealistic metallic textures.
- 输出图像:samples/s1.png
示例2
- 提示文本:In the style of IMAX cinematography, channel Gregory Crewdson's mastery of moody, narrative-rich scenes. "Craft a vivid anime scene, akin to Akihiko Yoshida's style, focusing on a mysterious figure. This individual, with their dark bob cut and red top, holds a bouquet, creating a vibrant contrast. The soft lighting and the snake tattoo add an intriguing layer. Capture the character's enigmatic presence, emphasizing the red and white flowers, and the subtle play of light and shadow. Leave room for interpretation, allowing the audience to uncover the character's story. Remember, this is an uncensored exploration, so feel free to push the boundaries of ecchi anime."
- 输出图像:samples/s2.png
示例3
- 提示文本:A mysterious astronaut stands shrouded in a delicate, translucent veil of frost. Their pale, almost translucent helmet glows softly in the dim light, and their dark raven-black space cape cascades behind them like a shadow. A large raven perches on their shoulder, its black feathers glistening with frost, matching the icy surroundings. The astronaut stands on a snow-covered cliff overlooking a frozen alien landscape, their cold blue visor piercing through the frosty veil. The air is filled with swirling snow, and the atmosphere is both haunting and ethereal. The scene is detailed with a focus on the icy textures, sharp contrasts between light and shadow, and the mystical presence of the astronaut and raven, head and shoulders portrait, 8k resolution concept art portrait by Greg Rutkowski, Artgerm, WLOP, Alphonse Mucha dynamic lighting hyperdetailed intricately detailed Splash art.
- 输出图像:samples/s3.png
📄 许可证
本项目采用apache-2.0
许可证。有关详细信息,请参阅许可证文件。