🚀 sdxl-emoji LoRA
sdxl-emoji LoRA 是由 fofr 打造的基于苹果表情符号的 SDXL 微调模型,能助力实现文本到图像的转换。

🚀 快速开始
✨ 主要特性
- 基于 SDXL 进行微调,以苹果表情符号为基础。
- 支持通过 Replicate API 进行推理。
- 可结合 🧨 diffusers 库使用。
📦 安装指南
使用 Replicate API 进行推理
- 从 这里 获取你的 Replicate 令牌。
- 安装
replicate
库并设置 API 令牌:
pip install replicate
export REPLICATE_API_TOKEN=r8_*************************************
使用 🧨 diffusers 进行推理
pip install diffusers transformers accelerate safetensors huggingface_hub
git clone https://github.com/replicate/cog-sdxl cog_sdxl
💻 使用示例
使用 Replicate API 进行推理
import replicate
output = replicate.run(
"sdxl-emoji@sha256:dee76b5afde21b0f01ed7925f0665b7e879c50ee718c5f78a9d38e04d523cc5e",
input={"prompt": "A TOK emoji of a man"}
)
print(output)
使用 🧨 diffusers 进行推理
import torch
from huggingface_hub import hf_hub_download
from diffusers import DiffusionPipeline
from cog_sdxl.dataset_and_utils import TokenEmbeddingsHandler
from diffusers.models import AutoencoderKL
pipe = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
variant="fp16",
).to("cuda")
pipe.load_lora_weights("SvenN/sdxl-emoji", weight_name="lora.safetensors")
text_encoders = [pipe.text_encoder, pipe.text_encoder_2]
tokenizers = [pipe.tokenizer, pipe.tokenizer_2]
embedding_path = hf_hub_download(repo_id="SvenN/sdxl-emoji", filename="embeddings.pti", repo_type="model")
embhandler = TokenEmbeddingsHandler(text_encoders, tokenizers)
embhandler.load_embeddings(embedding_path)
prompt="A <s0><s1> emoji of a man"
images = pipe(
prompt,
cross_attention_kwargs={"scale": 0.8},
).images
images[0]
📚 详细文档
你还可以通过 Node.js 或 curl 调用 API 进行推理,也可以使用 COG 和 Docker 在本地进行推理,查看该模型的 Replicate API 页面。
📄 许可证
本项目采用 creativeml-openrail-m
许可证。
信息表格
属性 |
详情 |
模型类型 |
基于 SDXL 的 LoRA 微调模型 |
基础模型 |
stabilityai/stable-diffusion-xl-base-1.0 |
关键调优 |
启用 |
文本嵌入 |
embeddings.pti |
实例提示 |
|
推理 |
支持 |