Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaMa Inpainting Model outputs 0 when running with GPU(Metal) #2960

Closed
K-prog opened this issue Jul 18, 2024 · 3 comments
Closed

LaMa Inpainting Model outputs 0 when running with GPU(Metal) #2960

K-prog opened this issue Jul 18, 2024 · 3 comments
Labels
question Further information is requested

Comments

@K-prog
Copy link

K-prog commented Jul 18, 2024

平台(如果交叉编译请再附上交叉编译目标平台):

Platform(Include target platform as well if cross-compiling):

MacOS Sonoma 14.5 ( M1 Pro )

Github版本:

Github Version:

直接下载ZIP包请提供下载日期以及压缩包注释里的git版本(可通过7z l zip包路径命令并在输出信息中搜索Comment 获得,形如Comment = bc80b11110cd440aacdabbf59658d630527a7f2b)。 git clone请提供 git commit 第一行的commit id
Commit = e1011161ed0382e1a33a65bfdde8bee931dbcfaf
Provide date (or better yet, git revision from the comment section of the zip. Obtainable using 7z l PATH/TO/ZIP and search for Comment in the output) if downloading source as zip,otherwise provide the first commit id from the output of git commit

编译方式:

Compiling Method

cmake

请在这里粘贴cmake参数或使用的cmake脚本路径以及完整输出
Paste cmake arguments or path of the build script used here as well as the full log of the cmake proess here or pastebin

https://github.com/uttarayan21/mnn-nix-overlay/blob/master/mnn.nix
Used cmake arguments

-DMNN_USE_SYSTEM_LIB=OFF -DMNN_BUILD_SHARED_LIBS=OFF -DMNN_SEP_BUILD=OFF -DMNN_BUILD_TOOLS=OFF -DMNN_PORTABLE_BUILD=ON -DMNN_METAL=ON

编译日志:

Build Log:

粘贴在这里
Paste log here or pastebin

build.log file was not generated.
image

I am Trying to implement the LaMa: Resolution-robust Large Mask Inpainting with Fourier Convolutions model on MNN, this runs properly on CPU backend but when selected METAL backend the output consists of all zeros. The original model is in pytorch so I used the ONNX implementation of it via this export notebook, both fp16 and fp32 versions of the model give 0 output on METAL

MNN Convert Command used:

./MNNConvert -f ONNX --modelFile lama_fp32.onnx --MNNModel lamafp16.mnn --fp16 --bizCode MNN --debug
image
Converted from a different machine(Linux)

GPU(Metal) Output:

image

CPU Output

image

Source Code and Model Files-> link

Code Snippet

image

P.s any other model runs fine on GPU(Metal), the problem is with this one

Any Help Would be Appreciated :)

@jxt1234 jxt1234 added bug Something isn't working question Further information is requested and removed bug Something isn't working labels Aug 7, 2024
@jxt1234
Copy link
Collaborator

jxt1234 commented Aug 7, 2024

We use testMNNFromOnnx.py and ModuleBasic.out to test for metal but not found error. Please update master to check.

@jxt1234
Copy link
Collaborator

jxt1234 commented Aug 7, 2024

Log:
Test /Users/xtjiang/Downloads/code/lamafp16.mnn from input info: onnx
image
mask
output: output
Use extra forward type: 1
precision=0 in main, 217
memory=0 in main, 218
power=0 in main, 219
cacheFileName=s .tempcache in main, 220
The device supports: i8sdot:1, fp16:1, i8mm: 0, sve2: 0
main, 282, cost time: 90.690002 ms
Run for 0 time
before compare output: (1, 3, 512, 512, )
TESTERROR output value error : absMaxV:255.000000 - DiffMax 11.478699
0 run Error for output output
Write output output to output/0_0.txt
memoryInMB=f 342.193878 in main, 404

@K-prog
Copy link
Author

K-prog commented Aug 11, 2024

thanks, it's working with the latest master branch!

@K-prog K-prog closed this as completed Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants