## 主要更新 - ✨ 更新所有依赖到最新稳定版本 - 📝 添加详细的项目文档和模型推荐 - 🔧 配置 VSCode Cloud Studio 预览功能 - 🐛 修复 PyTorch API 弃用警告 ## 依赖更新 - diffusers: 0.27.2 → 0.35.2 - gradio: 4.21.0 → 5.46.0 - peft: 0.7.1 → 0.18.0 - Pillow: 9.5.0 → 11.3.0 - fastapi: 0.108.0 → 0.116.2 ## 新增文件 - CLAUDE.md - 项目架构和开发指南 - UPGRADE_NOTES.md - 详细的升级说明 - .vscode/preview.yml - 预览配置 - .vscode/LAUNCH_GUIDE.md - 启动指南 - .gitignore - 更新的忽略规则 ## 代码修复 - 修复 iopaint/model/ldm.py 中的 torch.cuda.amp.autocast() 弃用警告 ## 文档更新 - README.md - 添加模型推荐和使用指南 - 完整的项目源码(iopaint/) - Web 前端源码(web_app/) 🤖 Generated with Claude Code
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
import torch
|
|
|
|
from iopaint.model_manager import ModelManager
|
|
from iopaint.schema import HDStrategy
|
|
from iopaint.tests.utils import get_config, check_device, assert_equal, current_dir
|
|
|
|
model_name = "timbrooks/instruct-pix2pix"
|
|
|
|
|
|
@pytest.mark.parametrize("device", ["cuda", "mps", "cpu"])
|
|
@pytest.mark.parametrize("disable_nsfw", [True, False])
|
|
@pytest.mark.parametrize("cpu_offload", [False, True])
|
|
def test_instruct_pix2pix(device, disable_nsfw, cpu_offload):
|
|
sd_steps = check_device(device)
|
|
model = ModelManager(
|
|
name=model_name,
|
|
device=torch.device(device),
|
|
disable_nsfw=disable_nsfw,
|
|
sd_cpu_textencoder=False,
|
|
cpu_offload=cpu_offload,
|
|
)
|
|
cfg = get_config(
|
|
strategy=HDStrategy.ORIGINAL,
|
|
prompt="What if it were snowing?",
|
|
sd_steps=sd_steps
|
|
)
|
|
|
|
name = f"device_{device}_disnsfw_{disable_nsfw}_cpu_offload_{cpu_offload}"
|
|
|
|
assert_equal(
|
|
model,
|
|
cfg,
|
|
f"instruct_pix2pix_{name}.png",
|
|
img_p=current_dir / "overture-creations-5sI6fQgYIuo.png",
|
|
mask_p=current_dir / "overture-creations-5sI6fQgYIuo_mask.png",
|
|
fx=1.3,
|
|
)
|