siliconflow / onediff

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

pad方法支持circular模式 #950

Open vincentmmc opened 2 weeks ago

vincentmmc commented 2 weeks ago

你好,请问什么时候pad方法可以支持circular模式? image

vincentmmc commented 1 week ago

@lijunliangTG

lijunliangTG commented 1 week ago

您好,请问是在什么场景下用到这个模式呢?为什么需要这个模式?

vincentmmc commented 1 week ago

您好,请问是在什么场景下用到这个模式呢?为什么需要这个模式?

你好,我是要实现一个无缝铺贴功能用到的这个模式,代码参考:https://github.com/tjm35/asymmetric-tiling-sd-webui/blob/main/scripts/asymmetric_tiling.py 第88、89行。 感谢回复~@lijunliangTG

vincentmmc commented 1 week ago

@lijunliangTG

lijunliangTG commented 1 week ago

请问您用的是什么模型,我这里复现一下

lijunliangTG commented 1 week ago
WARNING [2024-06-24 02:04:27] /data/home/lijunliang/project/onediff/src/onediff/utils/log_utils.py:33 - Logging handlers already exist for ONEDIFF
Pydantic version 1.10.11 is too low, please upgrade to 2.5.2 or higher.
ERROR [2024-06-24 02:04:28] /data/home/lijunliang/project/onediff/src/onediff/infer_compiler/backends/oneflow/transform/builtin_transform.py:221 - convert <class 'function'> failed: Transform failed of <class 'function'>: 'function' object has no attribute '<locals>'

ERROR [2024-06-24 02:04:28] /data/home/lijunliang/project/onediff/src/onediff/infer_compiler/backends/oneflow/deployable_module.py:38 - Exception in forward: e=NotImplementedError("Transform failed of <class 'ldm.modules.diffusionmodules.openaimodel.UNetModel'>: Transform failed of <class 'torch.nn.modules.container.ModuleList'>: Transform failed of <class 'ldm.modules.diffusionmodules.openaimodel.TimestepEmbedSequential'>: Transform failed of <class 'torch.nn.modules.conv.Conv2d'>: Unsupported type: <class 'function'>")
WARNING [2024-06-24 02:04:28] /data/home/lijunliang/project/onediff/src/onediff/infer_compiler/backends/oneflow/deployable_module.py:39 - Recompile oneflow module ...
ERROR [2024-06-24 02:04:29] /data/home/lijunliang/project/onediff/src/onediff/infer_compiler/backends/oneflow/transform/builtin_transform.py:221 - convert <class 'function'> failed: Transform failed of <class 'function'>: 'function' object has no attribute '<locals>'

当我复现时遇到了上面的情况 模型为sd1.5 ,请问您遇到的是否为这个情况

vincentmmc commented 1 week ago

@lijunliangTG 我遇到的情况是我想用oneflow.nn.functional.pad的circular mode但是oneflow提示还不支持,我想问这个模式有没有计划支持?

以下是我的调试代码 `import torch import oneflow

torch_ts = torch.randn((1,1,2,3)) torch_ts_circular = torch.nn.functional.pad(torch_ts,(1,1,0,0),mode='circular') print(torch_ts) print(torch_ts_circular)

oneflow_ts = oneflow.randn((1,1,2,3)) oneflow_ts_circular = oneflow.nn.functional.pad(oneflow_ts,(1,1,0,0),mode='circular') print(oneflow_ts) print(oneflow_ts_circular)`

以下是输出结果 `tensor([[[[ 1.2974, -0.3249, -0.2213], [-0.1191, -0.4286, 2.3114]]]])

tensor([[[[-0.2213, 1.2974, -0.3249, -0.2213, 1.2974], [ 2.3114, -0.1191, -0.4286, 2.3114, -0.1191]]]])

Traceback (most recent call last): File "pad_func_test.py", line 10, in oneflow_ts_circular = oneflow.nn.functional.pad(oneflow_ts,(1,1,0,0),mode='circular') File "/data1/python_envs/diffusers/lib/python3.8/site-packages/oneflow/nn/functional/pad.py", line 102, in pad raise NotImplementedError( NotImplementedError: 2D circular padding are not supported for now`

lijunliangTG commented 1 week ago

我正在尝试实现

vincentmmc commented 6 days ago

我正在尝试实现

thanks~~