SadTalker icon indicating copy to clipboard operation
SadTalker copied to clipboard

ValueError: setting an array element with a sequence in preprocess.py

Open pabst2009 opened this issue 1 year ago • 2 comments

I get the following error during the generation with Python 3.10.12 and Numpy 1.26.2 on ubuntu22.04:

Traceback (most recent call last):
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/gradio/blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/gradio/blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "/ihdd/ubuntu/sdweb/modules/call_queue.py", line 13, in f
    res = func(*args, **kwargs)
  File "/ihdd/ubuntu/sdweb/extensions/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 "/ihdd/ubuntu/sdweb/extensions/SadTalker/src/utils/preprocess.py", line 146, in generate
    trans_params, im1, lm1, _ = align_img(frame, lm1, self.lm3d_std)
  File "/ihdd/ubuntu/sdweb/extensions/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.

pabst2009 avatar Apr 12 '24 01:04 pabst2009

same problem

zmj2 avatar Apr 12 '24 08:04 zmj2

I get the following error during the generation with Python 3.10.12 and Numpy 1.26.2 on ubuntu22.04:

Traceback (most recent call last):
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/gradio/blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/gradio/blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "/ihdd/ubuntu/sdweb/modules/call_queue.py", line 13, in f
    res = func(*args, **kwargs)
  File "/ihdd/ubuntu/sdweb/extensions/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 "/ihdd/ubuntu/sdweb/extensions/SadTalker/src/utils/preprocess.py", line 146, in generate
    trans_params, im1, lm1, _ = align_img(frame, lm1, self.lm3d_std)
  File "/ihdd/ubuntu/sdweb/extensions/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.

Take a look here at a solution that works 100% https://github.com/OpenTalker/SadTalker/issues/822#issuecomment-2053857698

AppStolz avatar Apr 14 '24 02:04 AppStolz