stable-diffusion-webui-depthmap-script icon indicating copy to clipboard operation
stable-diffusion-webui-depthmap-script copied to clipboard

python crach on video generation step

Open czosnkowy666 opened this issue 1 year ago • 2 comments

On mac OS M1 CPU attempt to generate video fails spectacularly 😄 Python version is 3.11.9

2024-04-10 12:04:21.848 Python[79659:734356] *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:777
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000182dc6ccc __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x00000001828ae788 objc_exception_throw + 60
	2   Foundation                          0x0000000183f37c6c -[NSCalendarDate initWithCoder:] + 0
	3   AppKit                              0x0000000186585cbc -[NSMenu _setMenuName:] + 488
	4   AppKit                              0x000000018659a860 -[NSApplication setMainMenu:] + 372
	5   libqcocoa.dylib                     0x000000034282fe40 qt_plugin_instance + 81900
	6   libqcocoa.dylib                     0x000000034281bd88 libqcocoa.dylib + 32136
	7   QtGui                               0x000000035500d0f8 _ZN27QPlatformIntegrationFactory6createERK7QStringRK5QListIS0_ERiPPcS2_ + 192
	8   QtGui                               0x0000000354fdcd84 _ZN22QGuiApplicationPrivate25createPlatformIntegrationEv + 3404
	9   QtGui                               0x0000000354fdc588 _ZN22QGuiApplicationPrivate25createPlatformIntegrationEv + 1360
	10  QtGui                               0x0000000354fde828 _ZN22QGuiApplicationPrivate21createEventDispatcherEv + 36
	11  QtCore                              0x000000033c5e9858 _ZN23QCoreApplicationPrivate4initEv + 1560
	12  QtGui                               0x0000000354fd8f20 _ZN22QGuiApplicationPrivate4initEv + 72
	13  QtWidgets                           0x0000000360c69514 _ZN19QApplicationPrivate4initEv + 44
	14  QtWidgets                           0x0000000360c694d4 _ZN12QApplicationC2ERiPPci + 140
	15  QtWidgets.abi3.so                   0x000000035582b894 _ZL22init_type_QApplicationP17_sipSimpleWrapperP7_objectS2_PS2_S3_S3_ + 176
	16  sip.cpython-311-darwin.so           0x000000033bd88604 sipSimpleWrapper_init + 472
	17  Python                              0x0000000104e189b8 type_call + 136
	18  Python                              0x0000000104db6850 _PyObject_MakeTpCall + 128
	19  Python                              0x0000000104e945d0 _PyEval_EvalFrameDefault + 41952
	20  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	21  Python                              0x0000000104db77d0 PyObject_CallOneArg + 100
	22  Python                              0x0000000104e06318 _PyObject_GenericGetAttrWithDict + 512
	23  Python                              0x0000000104e8f8d4 _PyEval_EvalFrameDefault + 22244
	24  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	25  Python                              0x0000000104db6b6c _PyObject_FastCallDictTstate + 208
	26  Python                              0x0000000104e205d0 slot_tp_init + 188
	27  Python                              0x0000000104e189b8 type_call + 136
	28  Python                              0x0000000104db6850 _PyObject_MakeTpCall + 128
	29  Python                              0x0000000104e945d0 _PyEval_EvalFrameDefault + 41952
	30  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	31  Python                              0x0000000104db6b6c _PyObject_FastCallDictTstate + 208
	32  Python                              0x0000000104e205d0 slot_tp_init + 188
	33  Python                              0x0000000104e189b8 type_call + 136
	34  Python                              0x0000000104db6850 _PyObject_MakeTpCall + 128
	35  Python                              0x0000000104e945d0 _PyEval_EvalFrameDefault + 41952
	36  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	37  Python                              0x0000000104db733c _PyVectorcall_Call + 152
	38  Python                              0x0000000104e96404 _PyEval_EvalFrameDefault + 49684
	39  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	40  Python                              0x0000000104e96404 _PyEval_EvalFrameDefault + 49684
	41  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	42  Python                              0x0000000104e96404 _PyEval_EvalFrameDefault + 49684
	43  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	44  Python                              0x0000000104e96404 _PyEval_EvalFrameDefault + 49684
	45  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	46  Python                              0x0000000104eaf7b8 _PyObject_VectorcallTstate.4611 + 88
	47  Python                              0x0000000104eaf674 context_run + 92
	48  Python                              0x0000000104e01bf0 cfunction_vectorcall_FASTCALL_KEYWORDS + 76
	49  Python                              0x0000000104e96404 _PyEval_EvalFrameDefault + 49684
	50  Python                              0x0000000104e98a38 _PyEval_Vector + 116
	51  Python                              0x0000000104db9d2c method_vectorcall + 384
	52  Python                              0x0000000104f49b90 thread_run + 168
	53  Python                              0x0000000104ee9fa0 pythread_wrapper + 48
	54  libsystem_pthread.dylib             0x0000000182c72f94 _pthread_start + 136
	55  libsystem_pthread.dylib             0x0000000182c6dd34 thread_start + 8
)
libc++abi: terminating due to uncaught exception of type NSException
./webui.sh: line 292: 79659 Abort trap: 6           "${python_cmd}" -u "${LAUNCH_SCRIPT}" "$@"

czosnkowy666 avatar Apr 10 '24 20:04 czosnkowy666

Hi, I have the exact same issue on a M3 Mac. I'm running OSX 14.3 (23D56), Python 3.10.14, nightly build of torch.

I adapted the command args based on similar errors described by other users without success:

export COMMANDLINE_ARGS="--theme dark --skip-torch-cuda-test --upcast-sampling --no-half-vae --half --use-cpu interrogate"
export TORCH_COMMAND="pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --upgrade"

The rest is all the default config. The log output matches 100% the one from czosnkowy666, I get a window saying that Python quit unexpectedly.

Generating videos ..████████████▌| 2983271/3086064 [00:02<00:00, 1747200.37it/s]
fov: 53.13010235415598
2024-04-11 15:06:19.413 Python[1140:17184] *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:772
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse warning: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000018936c540 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x0000000188e5deb4 objc_exception_throw + 60
	2   Foundation                          0x000000018a4b639c -[NSCalendarDate initWithCoder:] + 0
	3   AppKit                              0x000000018cab2380 -[NSMenu _setMenuName:] + 488
	4   AppKit                              0x000000018cac6f24 -[NSApplication setMainMenu:] + 372
	5   libqcocoa.dylib                     0x000000057a1cbe40 qt_plugin_instance + 81900
	6   libqcocoa.dylib                     0x000000057a1b7d88 libqcocoa.dylib + 32136
	7   QtGui                               0x000000058a63d0f8 _ZN27QPlatformIntegrationFactory6createERK7QStringRK5QListIS0_ERiPPcS2_ + 192
	8   QtGui                               0x000000058a60cd84 _ZN22QGuiApplicationPrivate25createPlatformIntegrationEv + 3404
	9   QtGui                               0x000000058a60c588 _ZN22QGuiApplicationPrivate25createPlatformIntegrationEv + 1360
	10  QtGui                               0x000000058a60e828 _ZN22QGuiApplicationPrivate21createEventDispatcherEv + 36
	11  QtCore                              0x0000000589eb1858 _ZN23QCoreApplicationPrivate4initEv + 1560
	12  QtGui                               0x000000058a608f20 _ZN22QGuiApplicationPrivate4initEv + 72
	13  QtWidgets                           0x000000058b8f1514 _ZN19QApplicationPrivate4initEv + 44
	14  QtWidgets                           0x000000058b8f14d4 _ZN12QApplicationC2ERiPPci + 140
	15  QtWidgets.abi3.so                   0x000000058cbcb894 _ZL22init_type_QApplicationP17_sipSimpleWrapperP7_objectS2_PS2_S3_S3_ + 176
	16  sip.cpython-310-darwin.so           0x000000029a9b465c sipSimpleWrapper_init + 472
	17  Python                              0x000000010326e268 type_call + 288
	18  Python                              0x000000010320ef9c _PyObject_MakeTpCall + 136
	19  Python                              0x00000001032e9894 call_function + 272
	20  Python                              0x00000001032e26e8 _PyEval_EvalFrameDefault + 16824
	21  Python                              0x00000001032dd66c _PyEval_Vector + 396
	22  Python                              0x00000001032e9804 call_function + 128
	23  Python                              0x00000001032e2b18 _PyEval_EvalFrameDefault + 17896
	24  Python                              0x00000001032dd66c _PyEval_Vector + 396
	25  Python                              0x0000000103219db0 property_descr_get + 128
	26  Python                              0x000000010325c104 _PyObject_GenericGetAttrWithDict + 144
	27  Python                              0x00000001032e66a8 _PyEval_EvalFrameDefault + 33144
	28  Python                              0x00000001032dd66c _PyEval_Vector + 396
	29  Python                              0x00000001032e9804 call_function + 128
	30  Python                              0x00000001032e2b18 _PyEval_EvalFrameDefault + 17896
	31  Python                              0x00000001032dd66c _PyEval_Vector + 396
	32  Python                              0x00000001032121e0 method_vectorcall + 124
	33  Python                              0x00000001032e9804 call_function + 128
	34  Python                              0x00000001032e3f74 _PyEval_EvalFrameDefault + 23108
	35  Python                              0x00000001032dd66c _PyEval_Vector + 396
	36  Python                              0x000000010320f364 _PyObject_FastCallDictTstate + 208
	37  Python                              0x00000001032761bc slot_tp_init + 200
	38  Python                              0x000000010326e268 type_call + 288
	39  Python                              0x000000010320ef9c _PyObject_MakeTpCall + 136
	40  Python                              0x00000001032e9894 call_function + 272
	41  Python                              0x00000001032e2770 _PyEval_EvalFrameDefault + 16960
	42  Python                              0x00000001032dd66c _PyEval_Vector + 396
	43  Python                              0x000000010320f364 _PyObject_FastCallDictTstate + 208
	44  Python                              0x00000001032761bc slot_tp_init + 200
	45  Python                              0x000000010326e268 type_call + 288
	46  Python                              0x000000010320ef9c _PyObject_MakeTpCall + 136
	47  Python                              0x00000001032e9894 call_function + 272
	48  Python                              0x00000001032e2770 _PyEval_EvalFrameDefault + 16960
	49  Python                              0x00000001032dd66c _PyEval_Vector + 396
	50  Python                              0x000000010320fa68 PyVectorcall_Call + 176
	51  Python                              0x00000001032ded54 _PyEval_EvalFrameDefault + 2084
	52  Python                              0x00000001032dd66c _PyEval_Vector + 396
	53  Python                              0x00000001032e9804 call_function + 128
	54  Python                              0x00000001032e26e8 _PyEval_EvalFrameDefault + 16824
	55  Python                              0x00000001032dd66c _PyEval_Vector + 396
	56  Python                              0x00000001032e9804 call_function + 128
	57  Python                              0x00000001032e26e8 _PyEval_EvalFrameDefault + 16824
	58  Python                              0x0000000103223014 gen_send_ex2 + 224
	59  Python                              0x0000000103222e60 gen_iternext + 36
	60  Python                              0x00000001032da3f4 builtin_next + 72
	61  Python                              0x0000000103257b60 cfunction_vectorcall_FASTCALL + 88
	62  Python                              0x00000001032e9804 call_function + 128
	63  Python                              0x00000001032e26e8 _PyEval_EvalFrameDefault + 16824
	64  Python                              0x00000001032dd66c _PyEval_Vector + 396
	65  Python                              0x00000001032ded54 _PyEval_EvalFrameDefault + 2084
	66  Python                              0x00000001032dd66c _PyEval_Vector + 396
	67  Python                              0x00000001032ded54 _PyEval_EvalFrameDefault + 2084
	68  Python                              0x00000001032dd66c _PyEval_Vector + 396
	69  Python                              0x00000001032ded54 _PyEval_EvalFrameDefault + 2084
	70  Python                              0x00000001032dd66c _PyEval_Vector + 396
	71  Python                              0x00000001032fcd60 _PyObject_VectorcallTstate.4692 + 88
	72  Python                              0x00000001032fcc1c context_run + 92
	73  Python                              0x0000000103257ab0 cfunction_vectorcall_FASTCALL_KEYWORDS + 84
	74  Python                              0x00000001032ded54 _PyEval_EvalFrameDefault + 2084
	75  Python                              0x00000001032dd66c _PyEval_Vector + 396
	76  Python                              0x00000001032e9804 call_function + 128
	77  Python                              0x00000001032e2b18 _PyEval_EvalFrameDefault + 17896
	78  Python                              0x00000001032dd66c _PyEval_Vector + 396
	79  Python                              0x00000001032e9804 call_function + 128
	80  Python                              0x00000001032e2b18 _PyEval_EvalFrameDefault + 17896
	81  Python                              0x00000001032dd66c _PyEval_Vector + 396
	82  Python                              0x00000001032122ec method_vectorcall + 392
	83  Python                              0x00000001033864d4 thread_run + 120
	84  Python                              0x0000000103337d80 pythread_wrapper + 48
	85  libsystem_pthread.dylib             0x000000018921a034 _pthread_start + 136
	86  libsystem_pthread.dylib             0x0000000189214e3c thread_start + 8
)
libc++abi: terminating due to uncaught exception of type NSException
./webui.sh: line 292:  1140 Abort trap: 6           "${python_cmd}" -u "${LAUNCH_SCRIPT}" "$@"
/opt/homebrew/Cellar/[email protected]/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

Also, during the mesh generation, I always get this warning:

 WARNING:py.warnings:/Users/matt/GenAI/Automatic1111/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/inpaint/mesh_tools.py:174: RuntimeWarning: divide by zero encountered in divide
  input_disp = 1./np.abs(input_depth)

Maybe both are related ?

Somebody has an idea on what I should try ?

Thanks! :)

Helter-skelter42 avatar Apr 11 '24 13:04 Helter-skelter42

Small update.

Ive fixe the division by 0 in the mesh_tool.py by replacing line 174. from: input_disp = 1./np.abs(input_depth)

to input_disp = 1./(np.abs(input_depth) + 1e-8) # Add a small epsilon value to avoid division by zero

No more warning but the video generation still fails. Then as the error seems to happen in the pyQT part, I tried to use pyqt5 on the darwin platform instead of pyqt6 (pyqt5 is already used on Windows).

For this I changed line 502+ in the core.py file.

From:

        elif platform.system() == 'Darwin':
            vispy.use('PyQt6')

To:

        elif platform.system() == 'Darwin':
            vispy.use('PyQt5')

I still get the same exact error.

Lastly I tried to revert the pyqt6 library to version 6.6.0 instead of 6.6.1 to see if it was any recent regression. Nope, still the same. I'm out of ideas for now.

Can anybody with a Mx Mac confirm that he is able to generate a video ?

Helter-skelter42 avatar Apr 12 '24 14:04 Helter-skelter42