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

[Issue] ValueError: setting an array element with a sequence. #767

Open
siddharthahiremath opened this issue Dec 31, 2023 · 3 comments
Open

Comments

@siddharthahiremath
Copy link

Mac M1using safetensor as default
{'checkpoint': 'checkpoints/SadTalker_V0.0.2_256.safetensors', 'dir_of_BFM_fitting': 'src/config', 'audio2pose_yaml_path': 'src/config/auido2pose.yaml', 'audio2exp_yaml_path': 'src/config/auido2exp.yaml', 'use_safetensor': True, 'mappingnet_checkpoint': 'checkpoints/mapping_00229-model.pth.tar', 'facerender_yaml': 'src/config/facerender.yaml'}
/private/var/folders/dq/qn9smpk56lz_v4cjyx42gcfw0000gn/T/gradio/f025e7772587be8e91b9b4cb1b5c0041f5ca7da5/full_body_1.png
landmark Det:: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 3.23it/s]
3DMM Extraction In Video:: 0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/gradio/queueing.py", line 489, in call_prediction
output = await route_utils.call_process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/gradio/route_utils.py", line 232, in call_process_api
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/gradio/blocks.py", line 1561, in process_api
result = await self.call_function(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/gradio/blocks.py", line 1179, in call_function
prediction = await anyio.to_thread.run_sync(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/gradio/utils.py", line 678, in wrapper
response = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/Users/siddharthahiremath/SadTalker/src/gradio_demo.py", line 96, in test
first_coeff_path, crop_pic_path, crop_info = self.preprocess_model.generate(pic_path, first_frame_dir, preprocess, True, size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/siddharthahiremath/SadTalker/src/utils/preprocess.py", line 146, in generate
trans_params, im1, lm1, _ = align_img(frame, lm1, self.lm3d_std)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/siddharthahiremath/SadTalker/src/face3d/util/preprocess.py", line 101, in align_img
trans_params = np.array([w0, h0, s, t[0], t[1]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.

@xuxuxbaobao2
Copy link

Mac M1 使用 safetensor 默认 {'checkpoint': 'checkpoints/SadTalker_V0.0.2_256.safetensors', 'dir_of_BFM_fitting': 'src/config', 'audio2pose_yaml_path': 'src/config/auido2pose.yaml', 'audio2exp_yaml_path': ' src/config/auido2exp.yaml', 'use_safetensor': True, 'mappingnet_checkpoint': 'checkpoints/mapping_00229-model.pth.tar', 'facerender_yaml': 'src/config/facerender.yaml'} /private/var /文件夹/DQ/QN9SMPK56LZ_V4CJYX42GCFW0000GN/T/gradio/F025E77772587BE8E91B9B9B9B4CB1B1B1B5C0041F5CA7DCA7DA5A5/full_body_1.png Landmark Det :: 100%| ███████████████████████████████████████████████████ █ █████████████████████████████████████████| 1/1 [00:00<00:00, 3.23it/s] 视频中的 3DMM 提取:: 0%| | 0/1 [00:00<?, ?it/s] 回溯(最近一次调用): 文件“/opt/homebrew/lib/python3.11/site-packages/gradio/queueing.py”,第489行,在call_prediction 输出=等待route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 文件“/opt/ homebrew /lib/python3.11/site-packages/gradio/route_utils.py”,第 232 行,在 call_process_api 输出 = 等待 app.get_blocks().process_api( ^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^ 文件“/opt/homebrew/lib/python3.11/site-packages/gradio/blocks.py”,第1561行,process_api 结果 = 等待 self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 文件 "/opt/homebrew/lib/python3.11/site -packages/gradio/blocks .py”,第1179行,在call_function Prediction = wait anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ 文件中“/opt/homebrew/lib/python3.11/site-packages/anyio/to_thread.py”,第33行,在run_sync 返回中等待 get_asynclib().run_sync_in_worker_thread( ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 文件“ /opt/homebrew/lib/python3.11/site-packages/anyio/_backends/_asyncio.py”,第877行,在run_sync_in_worker_thread 返回等待未来 ^^^^^^^^^^^^^ 文件“/opt/ homebrew/lib/python3.11/site-packages/anyio/_backends/ _asyncio.py”,第807行,运行 结果 = context.run(func, *args) ^^^^^^^^^^^^^^ ^^^^^^^^^^^ 文件“/opt/homebrew/lib/python3.11/site-packages/gradio/utils.py”,第678行,包装器 响应 = f(*args, ** kwargs) ^^^^^^^^^^^^^^^ ^^^ 文件“/Users/siddharthahiremath/SadTalker/src/gradio_demo.py”,第96行,测试中 first_coeff_path,crop_pic_path,crop_info = self. preprocess_model.generate(pic_path,first_frame_dir,预处理,True, 文件“/Users/siddharthahiremath/SadTalker/src/utils/preprocess.py”,第146行,生成 trans_params, im1, lm1, _ =align_img(frame, lm1, self.lm3d_std) ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 文件“/Users/siddharthahiremath/SadTalker/src/face3d/util/preprocess.py”,第101行,在align_img trans_params = np.array([w0, h0, s, t[0], t[1]]) ^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^ ValueError:用序列设置阵列元素。请求的阵列在1维之后具有不均匀的形状。检测到的形状为(5,)+不均匀部分。

trans_params = np.array([w0, h0, s, t[0], t[1]]) 修改为trans_params = np.array([w0, h0, s, t[0], t[1]], dtype=object)

@arturhak24
Copy link

using safetensor as default
3DMM Extraction for source image
landmark Det:: 100%|████████████████████████████| 1/1 [00:00<00:00, 1.18it/s]
3DMM Extraction In Video:: 0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/Users/user/SadTalker/inference.py", line 144, in
main(args)
File "/Users/user/SadTalker/inference.py", line 46, in main
first_coeff_path, crop_pic_path, crop_info = preprocess_model.generate(pic_path, first_frame_dir, args.preprocess,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/SadTalker/src/utils/preprocess.py", line 146, in generate
trans_params, im1, lm1, _ = align_img(frame, lm1, self.lm3d_std)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/SadTalker/src/face3d/util/preprocess.py", line 101, in align_img
trans_params = np.array([w0, h0, s, t[0], t[1]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.

@Premik
Copy link

Premik commented Dec 11, 2024

Replacing that line 101 with trans_params = np.array([float(w0), float(h0), float(s), float(t[0]), float(t[1])]) worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants