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

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

Open
pabst2009 opened this issue Apr 12, 2024 · 2 comments
Open

Comments

@pabst2009
Copy link

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.
@zmj2
Copy link

zmj2 commented Apr 12, 2024

same problem

@AppStolz
Copy link

AppStolz commented Apr 14, 2024

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%
#822 (comment)

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

3 participants