oxford

Prompt
a family having dinner
Prompt
oxford style, a family having dinner
Prompt
oxford style, a cute rabbit reading a book under a big tree, watercolor texture

Model description


library_name: diffusers tags: - flux - text-to-image - lora - diffusers base_model: black-forest-labs/FLUX.1-dev instance_prompt: oxford style license: other

Oxford Tree Style LoRA for FLUX.1-dev

Model Description

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).

Trigger Word

You should use `oxford style` to trigger the image generation.

Usage

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}")

Trigger words

You should use oxford style to trigger the image generation.

Download model

Download them in the Files & versions tab.

Downloads last month
10
Inference Providers NEW
Examples

Model tree for Cookie1112/oxford-tree-style-lora

Adapter
(42629)
this model