bes-dev / stable_diffusion.openvino

Apache License 2.0
1.53k stars 207 forks source link

Can It Run on NCS2? #93

Closed ailelix closed 1 year ago

ailelix commented 1 year ago

I was trying to run this repo on this setup:

This repo runs well on my cpu (BTW, I got 5:30 and 10.3s/it in this setup)

And I change the "CPU" in the file sd_engine.py into "MYRIAD" (Using the NCS2)

And got the output:

Segmentation fault (core dumped)

It comes a while after the command inputted and output nothing else

I'm pretty sure that the driver is well installed and the NCS2 works well

So I wonder if it works on NCS2

(Theoretically it should be yes so I'm confused now

Anyway, thank your guys' contribution to this project

pip list:

addict 2.4.0 altair 4.2.0 attrs 19.3.0 Automat 0.8.0 backports.zoneinfo 0.2.1 blinker 1.4 cachetools 5.2.0 certifi 2019.11.28 chardet 3.0.4 charset-normalizer 2.1.1 Click 7.0 cloud-init 22.3.4 colorama 0.4.3 command-not-found 0.3 commonmark 0.9.1 configobj 5.0.6 constantly 15.1.0 cryptography 2.8 dbus-python 1.2.16 decorator 5.1.1 defusedxml 0.7.1 diffusers 0.2.4 distro 1.4.0 distro-info 0.23ubuntu1 entrypoints 0.3 fast_ctc_decode 0.3.2 fastjsonschema 2.15.3 filelock 3.8.0 ftfy 6.1.1 gitdb 4.0.9 GitPython 3.1.29 httplib2 0.14.0 huggingface-hub 0.9.0 hyperlink 19.0.0 idna 2.8 imagecodecs 2022.2.22 imageio 2.22.2 importlib-metadata 1.5.0 incremental 16.10.1 Jinja2 2.10.1 joblib 1.2.0 jsonpatch 1.22 jsonpointer 2.0 jsonschema 3.2.0 jstyleson 0.0.2 keyring 18.0.1 language-selector 0.1 launchpadlib 1.10.13 lazr.restfulclient 0.14.2 lazr.uri 1.0.3 lmdb 1.3.0 MarkupSafe 1.1.0 more-itertools 4.2.0 netifaces 0.10.4 networkx 2.8 nibabel 4.0.2 nltk 3.7 numpy 1.19.5 oauthlib 3.1.0 onnx 1.11.0 opencv-python 4.5.5.64

openvino 2022.2.0

openvino-dev 2022.2.0

openvino-telemetry 2022.1.1

packaging 21.3 pandas 1.1.5 parasail 1.3.3 pbr 5.10.0 pexpect 4.6.0 Pillow 9.2.0 pip 22.3 progress 1.6 protobuf 3.20.3 py-cpuinfo 9.0.0 pyarrow 9.0.0 pyasn1 0.4.2 pyasn1-modules 0.2.1 pyclipper 1.3.0.post3 pydeck 0.8.0b4 pydicom 2.3.0 Pygments 2.13.0 PyGObject 3.36.0 PyHamcrest 1.9.0 PyJWT 1.7.1 pymacaroons 0.13.0 Pympler 1.0.1 PyNaCl 1.3.0 pyOpenSSL 19.0.0 pyparsing 3.0.9 pyrsistent 0.15.5 pyserial 3.4 python-apt 2.0.0+ubuntu0.20.4.8 python-dateutil 2.8.2 python-debian 0.1.36ubuntu1 pytz 2022.5 pytz-deprecation-shim 0.1.0.post0 PyWavelets 1.4.1 PyYAML 6.0 rawpy 0.17.2 regex 2022.9.13 requests 2.28.1 requests-unixsocket 0.2.0 rich 12.6.0 sacremoses 0.0.53 scikit-image 0.19.3 scikit-learn 0.24.2 scipy 1.5.4 SecretStorage 2.3.1 semver 2.13.0 sentencepiece 0.1.97 service-identity 18.1.0 setuptools 65.5.0 Shapely 1.8.5.post1 simplejson 3.16.0 six 1.14.0 smmap 5.0.0 sos 4.4 ssh-import-id 5.10 streamlit 1.12.0 systemd-python 234 testresources 2.0.1 texttable 1.6.4 threadpoolctl 3.1.0 tifffile 2022.10.10 tokenizers 0.13.1 toml 0.10.2 toolz 0.12.0 torch 1.8.1 torchvision 0.9.1 tornado 6.2 tqdm 4.64.0 transformers 4.16.2 Twisted 18.9.0 typing_extensions 4.4.0 tzdata 2022.5 tzlocal 4.2 ubuntu-advantage-tools 27.11.2 ufw 0.36 unattended-upgrades 0.1 urllib3 1.25.8 validators 0.20.0 wadllib 1.3.3 watchdog 2.1.9 wcwidth 0.2.5 wheel 0.37.1 yacs 0.1.8 zipp 1.0.0 zope.interface 4.7.1

brmarkus commented 1 year ago

With OpenVINO v2022.1.0 within a Docker container I can confirm to see the same Segmentation fault (core dumped).

The Myriad-X (NCS2) is working in my Docker container environment with samples from Open-Model-Zoo - but not for this demo.

smileBeda commented 1 year ago

Same error with a completely different setup, which should be overqualified for SD...:

flash_on
7277 Multi-Core, 702 Single-Core
[Geekbench 4.2 Scores. Click for full Benchmark.](https://webdock.io/en/docs/webdock-control-panel/optimizing-performance/performance#ssd-byte)

7.5 Cores, 15 Threads
Intel® Xeon® CPUs

15 GB RAM
High-Speed Data Center Grade ECC RAM

150 GB On-Board SSD Drive
Fast Data Center SSD with ZFS
1 Gbit/s-Port
6 TB Outgoing Transfer Limit /month

1 dedicated IPv4 address
/124 IPv6 range (Up to 16 IPv6 addresses)
smileBeda commented 1 year ago

@ccxxvv77 FYI, while your setup is no where close to mine, I got the same error and the way I solved it was to massively increase resources.

11225 Multi-Core, 702 Single-Core
[Geekbench 4.2 Scores. Click for full Benchmark.](https://webdock.io/en/docs/webdock-control-panel/optimizing-performance/performance#ssd-premium)

15 Cores, 30 Threads
Intel® Xeon® CPUs

40 GB RAM
High-Speed Data Center Grade ECC RAM

400 GB On-Board SSD Drive
Fast Data Center SSD with ZFS
1 Gbit/s-Port
16 TB Outgoing Transfer Limit /month

1 dedicated IPv4 address
/124 IPv6 range (Up to 16 IPv6 addresses)

This did the trick. Still needs about 5 minutes for a standard command (no options passed). But at least the segmentation error is gone. Maybe this helps you too.

ailelix commented 1 year ago

TY for the information @smileBeda

That case I guess is that NCS2 is too slow for StableDiffusion Technically for FP32, I've not tested FP16 model yet

I've upgraded my server to 16 gigs of ram But now with WinServer and Python 3.10 it's really inconvenient to test again

Also, NCS2 comes to its end @brmarkus Technical support ends on June 30,2023 and 2024 for warranty

So I'm gonna just close the issue BTW, I got a Telsa P4 on my server and runs well with AUTOMATIC1111's repo