Downloads · 30 days
9
10% of all-time downloads
Cookie1112/oxford-tree-style-lora
oxford-tree-style-lora is a text-to-image model from Cookie1112. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as apache-2.0.
Downloads · 30 days
9
10% of all-time downloads
All-time downloads
91
Public
Repo size
173 MB
Likes
0
Public
Click a slice to open those files.
.safetensors172 MB · 99%
From the Hugging Face model README
library_name: diffusers tags:
This is a LoRA adapter trained on `black-forest-labs/FLUX.1-dev` to generate images in the Oxford Reading Tree style (watercolor, cute, storybook).
You should use `oxford style` to trigger the image generation.
import torch
from diffusers import FluxPipeline
# 1. 设置模型路径和 LoRA 路径
base_model_id = "black-forest-labs/FLUX.1-dev"
# 修改为您实际的 LoRA 文件路径
lora_path = "output/oxford_tree_style_v1/oxford_tree_style_v1_000001750.safetensors"
# 触发词
trigger_word = "oxford style"
# 2. 加载基础模型
print("正在加载基础模型...")
pipe = FluxPipeline.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16
)
# 如果您的显存只有 24G,这一步会自动把模型分配到 CPU 和 GPU,可能有点慢
pipe.enable_model_cpu_offload()
# 3. 加载您训练好的 LoRA
print(f"正在加载 LoRA: {lora_path}")
pipe.load_lora_weights(lora_path)
# 4. 生成图片
prompt = f"{trigger_word}, a cute rabbit reading a book under a big tree, watercolor texture"
print(f"正在生成: {prompt}")
image = pipe(
prompt,
height=1024,
width=1024,
guidance_scale=3.5,
num_inference_steps=20,
generator=torch.Generator("cuda").manual_seed(42)
).images[0]
# 5. 保存图片
output_file = "test_oxford_1750.png"
image.save(output_file)
print(f"图片已保存为: {output_file}")
You should use oxford style to trigger the image generation.
Download them in the Files & versions tab.