Open zaZaza7979 opened 7 months ago
same here
same here. Sad talker not working after updating to 1.8. Just rollback to 1.7 and everything will be fine
If you upgrade from v1.7 to v1.8 Automatic1111 then it's ok as long as you DON'T upgrade torch & xformers (by running webui.bat with --reinstall-torch --reinstall-xformer)
SadTalker works ok with version: v1.8.0 • python: 3.10.13 • torch: 2.0.1+cu118 • xformers: 0.0.20 SadTalker does NOT work with version: v1.8.0 • python: 3.10.13 • torch: 2.1.2+cu121 • xformers: 0.0.23.post1
I find that Automatic v1.8 runs about 25% faster than v1.7 for image generation, haven't tested speed difference of SadTalker, so yeah would be good to have SadTalker work with the latest v1.8 and latest torch & xformers.
Why cant sadtalker just upgrade to the latest torch and xformers
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] Version: 1.8.0-RC Commit hash: Launching Web UI with arguments: --xformers [-] ADetailer initialized. version: 24.3.0, num models: 12 ControlNet preprocessor location: H:\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads 2024-03-11 09:49:53,800 - ControlNet - INFO - ControlNet v1.1.441 2024-03-11 09:49:54,046 - ControlNet - INFO - ControlNet v1.1.441 Loading weights [9b61f620fe] from H:\stable-diffusion-webui\models\Stable-diffusion\rdbsg_v5025D.safetensors Creating model from config: H:\stable-diffusion-webui\configs\v1-inference.yaml 2024-03-11 09:49:55,902 - ControlNet - INFO - ControlNet UI callback registered. load Sadtalker Checkpoints from .\extensions\SadTalker\checkpoints ** Error executing callback ui_tabs_callback for H:\stable-diffusion-webui\extensions\SadTalker\scripts\extension.py Traceback (most recent call last): File "H:\stable-diffusion-webui\modules\script_callbacks.py", line 180, in ui_tabs_callback res += c.callback() or [] File "H:\stable-diffusion-webui\extensions\SadTalker\scripts\extension.py", line 172, in on_ui_tabs from app_sadtalker import sadtalker_demo File "H:\stable-diffusion-webui/extensions/SadTalker\app_sadtalker.py", line 3, in from src.gradio_demo import SadTalker File "H:\stable-diffusion-webui/extensions/SadTalker\src\gradio_demo.py", line 6, in from src.generate_batch import get_data File "H:\stable-diffusion-webui/extensions/SadTalker\src\generate_batch.py", line 8, in import src.utils.audio as audio File "H:\stable-diffusion-webui/extensions/SadTalker\src\utils\audio.py", line 1, in import librosa File "H:\stable-diffusion-webui\venv\lib\site-packages\librosainit.py", line 211, in from . import core File "H:\stable-diffusion-webui\venv\lib\site-packages\librosa\coreinit.py", line 9, in from .constantq import # pylint: disable=wildcard-import File "H:\stable-diffusion-webui\venv\lib\site-packages\librosa\core\constantq.py", line 1058, in dtype=np.complex, File "H:\stable-diffusion-webui\venv\lib\site-packages\numpyinit.py", line 338, in getattr raise AttributeError(former_attrs[attr]) AttributeError: module 'numpy' has no attribute 'complex'.
- np.complex_ was a deprecated alias for the builtin complex. To avoid this error in existing code, use complex by itself. Doing this - will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.complex128 here.
- The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
- https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
is there a plan for sadtalker to be compatible with v 1.8?
The bug seems not to be with SadTalker, but with the librosa python library. You can fix it by first finding the file "constantq.py" in your venv directory:
venv\lib\site-packages\librosa\core\constantq.py
Stop your WebGUI. Then edit this file and find the line 1058. It should read:
dtype=np.complex,
which is outdated and causes the error. Change that to:
dtype=complex,
Save and restart your WebGUI. Now, everything should start without error and the SadTalker tab re-appears.
WARNING: This may cause problems at a later point in time when the librosa library is updated. Or maybe it won't, I don't know. Just be careful and make a backup before changing stuff :-)
Thanks Buddy working perfect
thanks buddy
The bug seems not to be with SadTalker, but with the librosa python library. You can fix it by first finding the file "constantq.py" in your venv directory:
venv\lib\site-packages\librosa\core\constantq.py
Stop your WebGUI. Then edit this file and find the line 1058. It should read:
dtype=np.complex,
which is outdated and causes the error. Change that to:
dtype=complex,
Save and restart your WebGUI. Now, everything should start without error and the SadTalker tab re-appears.
WARNING: This may cause problems at a later point in time when the librosa library is updated. Or maybe it won't, I don't know. Just be careful and make a backup before changing stuff :-)
THis worked and allowed the Sadtalker to be in the tab again but there is an error
i am running webui forge. is it possible to install a stable diffusion webui 1.7 with sadtalker on the same drive as a standalone version? where do i get the older installation files?
I upgraded librosa (command: python -m pip install -U librosa) to the latest version (0.10.1) and found it fixed.
I upgraded librosa (command: python -m pip install -U librosa) to the latest version (0.10.1) and found it fixed.
it works.well done,thanks.
Sadtalker will show again in the tab after fixing with the work arounds mentioned above but if you try to click generate another error will appear: AttributeError: module 'numpy' has no attribute 'float'
Sadtalker will show again in the tab after fixing with the work arounds mentioned above but if you try to click generate another error will appear: AttributeError: module 'numpy' has no attribute 'float'
To resolve the issue with Sad Talker in the WebUI, please follow the instructions below:
my_awing_arch.py
extensions/SadTalker/src/face3d/util
.my_awing_arch.py
.preds = preds.astype(np.float, copy=False)
preds = preds.astype(float, copy=False)
preprocess.py
extensions/SadTalker/src/face3d/util
.preprocess.py
.from numpy import array
trans_params = np.array([w0, h0, s, t[0], t[1]])
trans_params = array([float(w0), float(h0), float(s), float(t[0]), float(t[1])])
audio.py
extensions/SadTalker/src/utils
.audio.py
.return librosa.stft(y=y, n_fft=hp.n_fft, hop_length=get_hop_size(), win_length=hp.win_size)
return librosa.stft(y=y, n_fft=hp.n_fft, hop_length=get_hop_size(), win_length=hp.win_size, dtype=float)
After making these changes, save the files and run your WebUI again. These modifications should fix any issues with Sad Talker in the WebUI.
I hope this guide helps you out. If you need further assistance, please don't hesitate to reach out.
Its working fine now. Thx. I used https://www.sublimetext.com/download_thanks?target=win-x64 because IDLE 3.10 64 bit cant open my_awing_arch.py in my win 10 pc.
Sadtalker is now running fine in version 1.8. Im just wondering: is it that hard to just update sadtalker so that we wont have to edit the .py files manually? Im not a programmer so i have no idea
Sadtalker will show again in the tab after fixing with the work arounds mentioned above but if you try to click generate another error will appear: AttributeError: module 'numpy' has no attribute 'float'
To resolve the issue with Sad Talker in the WebUI, please follow the instructions below:
Changes in
my_awing_arch.py
- Navigate to
extensions/SadTalker/src/face3d/util
.- Open the file
my_awing_arch.py
.- Locate the line:
preds = preds.astype(np.float, copy=False)
- Replace this line with:
preds = preds.astype(float, copy=False)
Changes in
preprocess.py
- Navigate to
extensions/SadTalker/src/face3d/util
.- Open the file
preprocess.py
.- Add the following import at the beginning of the file where you use the array:
from numpy import array
- Find the line in the same file:
trans_params = np.array([w0, h0, s, t[0], t[1]])
- Replace this line with:
trans_params = array([float(w0), float(h0), float(s), float(t[0]), float(t[1])])
Changes in
audio.py
- Navigate to
extensions/SadTalker/src/utils
.- Open the file
audio.py
.- Find the line:
return librosa.stft(y=y, n_fft=hp.n_fft, hop_length=get_hop_size(), win_length=hp.win_size)
- Replace this line with:
return librosa.stft(y=y, n_fft=hp.n_fft, hop_length=get_hop_size(), win_length=hp.win_size, dtype=float)
After making these changes, save the files and run your WebUI again. These modifications should fix any issues with Sad Talker in the WebUI.
I hope this guide helps you out. If you need further assistance, please don't hesitate to reach out.
@AppStolz Thanks for providing the fix. Seems firstly need to fix venv/Lib/site-packages/librosa/core/constantq.py line 1058 as mentioned by @Zhjhp2020. And I suspect updating the venv's librosa version to 0.10.1 as mentioned by @Timo9Madrid7 on thread https://github.com/OpenTalker/SadTalker/issues/862 also work tho I didn't try.
Otherwise it will give the following when importing librosa
** Error executing callback ui_tabs_callback for D:\PycharmProjects\CSCI-E104-FinalProjTest\stable-diffusion-webui\extensions\SadTalker\scripts\extension.py
Traceback (most recent call last):
File "D:\PycharmProjects\CSCI-E104-FinalProjTest\stable-diffusion-webui\modules\script_callbacks.py", line 180, in ui_tabs_callback
res += c.callback() or []
File "D:\PycharmProjects\CSCI-E104-FinalProjTest\stable-diffusion-webui\extensions\SadTalker\scripts\extension.py", line 172, in on_ui_tabs
from app_sadtalker import sadtalker_demo
File "D:\PycharmProjects\CSCI-E104-FinalProjTest\stable-diffusion-webui/extensions/SadTalker\app_sadtalker.py", line 3, in np.complex
was a deprecated alias for the builtin complex
. To avoid this error in existing code, use complex
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.complex128
here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
After that, it will still say various np.float problem as you described and your solution helped fixing that.
my librosa is librosa 0.9.2
Hey, thanks for all the info and tips. Sadly this all doesn't fix it for me. I have updated librosa, no success. I have done the mentioned changes, no success. I am still stuck with the "complex" error.
EDIT; also tried the pull request here: https://github.com/OpenTalker/SadTalker/pull/869
Any further ideas?
嘿,感谢您提供的所有信息和提示。可悲的是这一切并不能解决我的问题。我已经更新librosa了,没有成功。我已经完成了提到的更改,但没有成功。我仍然遇到“复杂”错误。
编辑;还尝试了这里的拉取请求:#869
还有其他想法吗?
Hi @ReinerBforartists,
Could you please visit to "E: automattic111\stable-diffusion-webuilvenvlib\site-packages\librosalcorelconstantq.py"
?
If you have updated librosa
to 0.10.1
, you will find np.complex
has been changed to np.complex64
like the image I show below:
Otherwise, you have probably updated librosa
for other environments rather than for the environment of stable-diffusion-web-ui. You can clarify it by entering your ~<stable-diffusion-web-ui venv>/Scripts
folder through your terminal where it has files activate
and activate.bat
. Then you can activate the environment using the command activate
or activate.bat
. After that, you can use the command pip list | findstr librosa
(Windows) or pip list | grep librosa
(Linux) to see if the version is correct, such as 0.10.1
.
Gotcha. The global pip is version librosa 10.1. But when calling from the console in the venv of stable-diffusion-webui it told me librosa version 0.8.0. I have updated it with python -m pip install -U librosa now. And now it shows version 0.10.1. And now i have my sadtalker tab and no errors anymore.
Many thanks. This solved it for me :)
Hey, thanks for all the info and tips. Sadly this all doesn't fix it for me. I have updated librosa, no success. I have done the mentioned changes, no success. I am still stuck with the "complex" error.
EDIT; also tried the pull request here: #869
Any further ideas?
This is correct. I don't have a Windows machine and cannot reproduce it. It should be related to the environment. Your library should still be incorrect
Gotcha. The global pip is version librosa 10.1. But when calling from the console in the venv of stable-diffusion-webui it told me librosa version 0.8.0. I have updated it with python -m pip install -U librosa now. And now it shows version 0.10.1. And now i have my sadtalker tab and no errors anymore.
Many thanks. This solved it for me :)
I see you solved it. Sorry for the late reply
Great solution!!! One simple typo: Changes in preprocess.py
trans_params = np.array([w0, h0, s, t[0], t[1]])
Replace this line with:
trans_params = np.array([float(w0), float(h0), float(s), float(t[0]), float(t[1])])
I upgraded librosa (command: python -m pip install -U librosa) to the latest version (0.10.1) and found it fixed.
holyshit, it works in sd 1.9.4
Tried like every fix here its still not showing
After updating webUI 1.8, Sadtalker error appears and the tab is not visible in the webUI. Is there any solution for this?