🚀 FLUX.1-dev-LoRA-AutumnSpringTrees
本项目是基于 FLUX.1 [dev] 的 LoRA 微调模型,专门用于生成 HuggingFace/SmolLM 表情符号图标。
✨ 主要特性
- 增强了 FLUX.1 [dev] 生成 Hugging Face 表情符号图标的能力,可用于在 Hugging Face 上开展新项目。
- 使用触发词
HuggingFaceIcons
激活特定的 Hugging Face 图标生成功能。
📦 安装指南
首先,确保你已经安装了 FLUX.1 [dev]:
pip install -U diffusers
import torch
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()
pipe.load_lora_weights("Borcherding/FLUX.1-dev-LoRA-HuggingFaceIcons-v0.1")
prompt = "HuggingFaceIcons a yellow smiley face sun with a book in its hands, surrounded by planets and stars in a dark background."
image = pipe(
prompt,
height=1024,
width=1024,
guidance_scale=3.5,
num_inference_steps=50,
max_sequence_length=512,
generator=torch.Generator("cpu").manual_seed(0)
).images[0]
image.save("autumn-scene.png")
pipe.unload_lora_weights()
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
pipe.load_lora_weights("Borcherding/FLUX.1-dev-LoRA-HuggingFaceIcons-v0.1")
pipe.merge_lora_weights()
pipe.save_pretrained("FLUX.1-dev-LoRA-HuggingFaceIcons-v0.1")
💻 使用示例
基础用法
你可以使用以下示例代码进行图像生成:
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()
pipe.load_lora_weights("Borcherding/FLUX.1-dev-LoRA-HuggingFaceIcons-v0.1")
prompt = "HuggingFaceIcons a yellow smiley face sun with a book in its hands, surrounded by planets and stars in a dark background."
image = pipe(
prompt,
height=1024,
width=1024,
guidance_scale=3.5,
num_inference_steps=50,
max_sequence_length=512,
generator=torch.Generator("cpu").manual_seed(0)
).images[0]
image.save("autumn-scene.png")
高级用法
如果你需要永久合并 LoRA 权重,可以使用以下代码:
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()
pipe.load_lora_weights("Borcherding/FLUX.1-dev-LoRA-HuggingFaceIcons-v0.1")
pipe.merge_lora_weights()
pipe.save_pretrained("FLUX.1-dev-LoRA-HuggingFaceIcons-v0.1")
📚 详细文档
触发词
你应该使用 HuggingFaceIcons
来触发图像生成。将触发词放在提示词的开头可获得最佳效果。
提示词示例
- "HuggingFaceIcons a yellow smiley face emoji with its hands on its face, set against a black background. It is an animated emoji, with a cheerful expression and bright colors."
- "HuggingFaceIcons a yellow smiley face emoji watering a potted plant with a blue watering can. The plant is in a pot and the background is white."
- "HuggingFaceIcons a yellow smiley face sun with a book in its hands, surrounded by planets and stars in a dark background."
特殊功能
可以生成黄色笑脸表情符号,手持物品、穿着喷气背包等特定样式的图标。
模型下载
该模型的权重以 Safetensors 格式提供。
点击下载,可在“文件与版本”选项卡中获取。
🔧 技术细节
- 数据集:使用了
Borcherding/HuggingFaceIcons-imageAnnotations-v0.1
数据集。
- 基础模型:
black-forest-labs/FLUX.1-dev
。
- 训练方式:使用 Fluxgym 进行训练,详情见:https://github.com/cocktailpeanut/fluxgym 。
📄 许可证
本 LoRA 遵循与 FLUX.1 [dev] 相同的许可条款。请参考基础模型的许可证以了解使用条款。
版权信息
- 基础模型:由 Black Forest Labs 开发的 FLUX.1 [dev]。
- LoRA 训练与开发:[Borcherding at BorchInk]
局限性
- 这是 FLUX.1 [dev] 的 LoRA,需要基础模型才能运行。
- 专注于生成 Hugging Face 图标。
- 在小数据集上进行训练。
- 继承了 FLUX.1 [dev] 的基础局限性。