towhee-io / towhee

Towhee is a framework that is dedicated to making neural data processing pipelines simple and fast.
https://towhee.io
Apache License 2.0
3.23k stars 249 forks source link

[Bug]: I use the same model, windos and linux generate completely different vectors #1044

Closed emmataobao closed 2 years ago

emmataobao commented 2 years ago

Is there an existing issue for this?

Current Behavior

model towhee/image-embedding-regnetx-016 path photo/202008/13/mapp202008130105517751.jpg Windows 10 python 3.9 towhee 0.5.1 vector centos 7 python 3.7 towhee 0.5.1

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- Towhee version(e.g. v0.1.3 or 8b23a93):
- OS(Ubuntu or CentOS):
- CPU/Memory:
- GPU:
- Others:

Anything else?

No response

emmataobao commented 2 years ago

image (1) image

binbinlv commented 2 years ago

Actually, I found the difference is at the last bits of each element, for example: "0.021529437974095345" and "0.0215294249355793", " it is the same with the previous 7 bits "0.0215294", and the remaining is different.

I think this may be the difference between different OS and different python version.

@filip-halt Could you help to have a look too? Thanks.

jaelgu commented 2 years ago

@emmataobao Can you check what is your output dtype? I've checked this pipeline and its output has dtype=float32. But according to your results, it looks like your dtype is about float64. If so, then the extra floats expanded are not precise.

fzliu commented 2 years ago

The results that you see are normal and are a result of inaccuracies in floating point math. Do you need the vectors to be entirely identical between the two? If you want to check for equality, you should be able to use numpy.isclose.

emmataobao commented 2 years ago

Thank you