siliconflow / onediff

OneDiff: An out-of-the-box acceleration library for diffusion models.
https://github.com/siliconflow/onediff/wiki
Apache License 2.0
1.41k stars 85 forks source link

Avoid installing both oneflow and nextforce #938

Closed ccssu closed 3 weeks ago

ccssu commented 3 weeks ago

避免既要安装oneflow 还要安装 nexfort

notebook demo

测试代码:

from diffusers import AutoPipelineForText2Image
import torch
from onediffx import compile_pipe

options = {'mode': 'jit:disable-runtime-fusion:low-precision', 'dynamic': False, 'fullgraph': False}
pipeline_text2image = AutoPipelineForText2Image.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
).to("cuda")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"

pipeline_text2image = compile_pipe(pipeline_text2image, backend="nexfort", options=options)
image = pipeline_text2image(prompt=prompt).images[0]
image.save("demo.png")
clackhan commented 3 weeks ago

nexfort 天然做了隔离是吧,可以试试不安装nexfort的情况下用oneflow后端跑

strint commented 3 weeks ago

nexfort 天然做了隔离是吧,可以试试不安装nexfort的情况下用oneflow后端跑

主要是之前有些公共的代码,默认 import 了 oneflow,需要清理掉。

nexfort 是后加的,不会默认 import

ccssu commented 3 weeks ago

nexfort 天然做了隔离是吧,可以试试不安装nexfort的情况下用oneflow后端跑

hao, 本地也简单测试过了这个case 是ok的, 目前 ci 是这种情况(不安装nexfort的情况下用oneflow后端),等 ci 测其他的。