Skip to content

error when use Gen Texture Shape #114

@vuaieo

Description

@vuaieo

hi i having error that cant complete model generation with textures.

this is what i did:

  1. i created python 3.10 enviroment with conda and activated it.
    1.5 installed cuda12.8 in conda enviroment

  2. then i installed torch with this command: "pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128"

  3. or even tryed ago with nightly version: "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128" (but same results...)

  4. then i did run the commands from the Install Requirements: "pip install -r requirements.txt

cd hy3dpaint/custom_rasterizer
pip install -e .
cd ../..
cd hy3dpaint/DifferentiableRenderer
bash compile_mesh_painter.sh
cd ../..

wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P hy3dpaint/ckpt"

  1. then used the Gradio App commands: "python3 gradio_app.py
    --model_path tencent/Hunyuan3D-2.1
    --subfolder hunyuan3d-dit-v2-1
    --texgen_model_path tencent/Hunyuan3D-2.1
    --low_vram_mode"

but it gave me errors:

"(pyenv) vuaieo@LEXX:~/Hunyuan3D-2.1$ python3 gradio_app.py --model_path tencent/Hunyuan3D-2.1 --subfolder hunyuan3d-dit-v2-1 --texgen_model_path tencent/Hunyuan3D-2.1 --low_vram_mode
Torchvision version: 0.22.1+cu128
torchvision.transforms.functional_tensor not found, applying compatibility fix...
Applied compatibility fix: created functional_tensor mock module
Loading example img list ...
Loading example txt list ...
Applying torchvision compatibility fix for texture generation...
Torchvision version: 0.22.1+cu128
torchvision.transforms.functional_tensor is available
InPaint Function CAN NOT BE Imported!!!
Fetching 19 files: 100%|████████████████████████████████████████████████████| 19/19 [00:00<00:00, 383133.54it/s]
Loading pipeline components...: 0%| | 0/6 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 811, in _get_module
return importlib.import_module("." + module_name, self.name)
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/diffusers/pipelines/onnx_utils.py", line 31, in
import onnxruntime as ort
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/init.py", line 56, in
raise import_capi_exception
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/init.py", line 23, in
from onnxruntime.capi._pybind_state import ExecutionMode # noqa: F401
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/capi/_pybind_state.py", line 32, in
from .onnxruntime_pybind11_state import * # noqa
ImportError: /home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-310-x86_64-linux-gnu.so: cannot enable executable stack as shared object requires: Invalid argument

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/vuaieo/Hunyuan3D-2.1/gradio_app.py", line 804, in
tex_pipeline = Hunyuan3DPaintPipeline(conf)
File "/home/vuaieo/Hunyuan3D-2.1/hy3dpaint/textureGenPipeline.py", line 84, in init
self.load_models()
File "/home/vuaieo/Hunyuan3D-2.1/hy3dpaint/textureGenPipeline.py", line 89, in load_models
self.models["multiview_model"] = multiviewDiffusionNet(self.config)
File "/home/vuaieo/Hunyuan3D-2.1/./hy3dpaint/utils/multiview_utils.py", line 43, in init
pipeline = DiffusionPipeline.from_pretrained(
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py", line 876, in from_pretrained
loaded_sub_model = load_sub_model(
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 649, in load_sub_model
if issubclass(class_obj, diffusers_module.OnnxRuntimeModel):
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 802, in getattr
value = getattr(module, name)
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 801, in getattr
module = self._get_module(self._class_to_module[name])
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/diffusers/utils/import_utils.py", line 813, in _get_module
raise RuntimeError(
RuntimeError: Failed to import diffusers.pipelines.onnx_utils because of the following error (look up to see its traceback):
/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-310-x86_64-linux-gnu.so: cannot enable executable stack as shared object requires: Invalid argument
Error loading texture generator: Failed to import diffusers.pipelines.onnx_utils because of the following error (look up to see its traceback):
/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-310-x86_64-linux-gnu.so: cannot enable executable stack as shared object requires: Invalid argument
Failed to load texture generator.
Please try to install requirements by following README.md
Traceback (most recent call last):
File "/home/vuaieo/Hunyuan3D-2.1/gradio_app.py", line 833, in
from hy3dshape.rembg import BackgroundRemover
File "/home/vuaieo/Hunyuan3D-2.1/./hy3dshape/hy3dshape/rembg.py", line 16, in
from rembg import remove, new_session
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/rembg/init.py", line 5, in
from .bg import remove
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/rembg/bg.py", line 7, in
import onnxruntime as ort
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/init.py", line 56, in
raise import_capi_exception
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/init.py", line 23, in
from onnxruntime.capi._pybind_state import ExecutionMode # noqa: F401
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/capi/_pybind_state.py", line 32, in
from .onnxruntime_pybind11_state import * # noqa
ImportError: /home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-310-x86_64-linux-gnu.so: cannot enable executable stack as shared object requires: Invalid argument
Error: Not freed memory blocks: 27496, total unfreed memory 9.211475 MB"

  1. so i asked around AIs and after hours or trying to understand the problem and installing things with "conda install -c conda-forge onnxruntime" which didnt worked, then turned out i had to install llike this: "pip install onnxruntime-gpu"

  2. but when i start the gradio app, it runs and i can generate mesh model but when i try generate textured 3D model then i getting error always no matter what low value settings i use:

Image

this is console output from starting gradio app:

"(pyenv) vuaieo@LEXX:~/Hunyuan3D-2python3 gradio_app.py --model_path tencent/Hunyuan3D-2.1 --subfolder hunyuan3d-dit-v2-1 --texgen_model_path tencent/Hunyuan3D-2.1 --low_vram_mode
Torchvision version: 0.22.1+cu128
torchvision.transforms.functional_tensor not found, applying compatibility fix...
Applied compatibility fix: created functional_tensor mock module
Loading example img list ...
Loading example txt list ...
Applying torchvision compatibility fix for texture generation...
Torchvision version: 0.22.1+cu128
torchvision.transforms.functional_tensor is available
InPaint Function CAN NOT BE Imported!!!
Fetching 19 files: 100%|██████████████████████████████████████████████████████████| 19/19 [00:00<00:00, 365558.61it/s]
Loading pipeline components...: 100%|███████████████████████████████████████████████████| 6/6 [00:04<00:00, 1.28it/s]
Models Loaded.
2025-07-21 18:01:07,726 - hy3dgen.shapgen - INFO - Try to load model from local path: /home/vuaieo/.cache/hy3dgen/tencent/Hunyuan3D-2.1/hunyuan3d-dit-v2-1
2025-07-21 18:01:07,729 - hy3dgen.shapgen - INFO - Loading model from /home/vuaieo/.cache/hy3dgen/tencent/Hunyuan3D-2.1/hunyuan3d-dit-v2-1/model.fp16.ckpt
using moe
using moe
using moe
using moe
using moe
using moe
PointCrossAttentionEncoder INFO: pc_sharpedge_size is zero
INFO: Started server process [52074]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO: 127.0.0.1:45332 - "GET / HTTP/1.1" 307 Temporary Redirect
INFO: 127.0.0.1:45332 - "GET // HTTP/1.1" 200 OK
INFO: 127.0.0.1:45332 - "GET /gradio_api/heartbeat/5imxe1t0rbl HTTP/1.1" 200 OK
INFO: 127.0.0.1:45336 - "GET /theme.css?v=af66930c6b21000bbd1ac78b002361c4c0013947b467468ee478903a5dab794a HTTP/1.1" 200 OK
INFO: 127.0.0.1:45336 - "GET /static/fonts/IBMPlexSans/IBMPlexSans-Regular.woff2 HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:45336 - "GET /static/fonts/ui-sans-serif/ui-sans-serif-Regular.woff2 HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:45348 - "GET /static/fonts/system-ui/system-ui-Regular.woff2 HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:45336 - "GET /static/fonts/IBMPlexSans/IBMPlexSans-Bold.woff2 HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:45348 - "GET /gradio_api/file%3D/tmp/gradio/5ef54c4308d7884cff604e52c339fb0dd3ff397e44b8378422b72cd295a79df3/052.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45386 - "GET /gradio_api/file%3D/tmp/gradio/0e073836d7ba47b56f829e3680a6483ac40cf926428a1d19bb3f1769b5184a1e/1008.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45336 - "GET /gradio_api/file%3D/tmp/gradio/2926f6dcecd55f66e0cbe1c112f6025882243b65f78b8290ba5619405559c880/004.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45358 - "GET /gradio_api/file%3D/tmp/gradio/620b77d9a4c6947dfcc125418b9969863e9d4394e4ce9df2ba2c433547714005/073.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45374 - "GET /gradio_api/file%3D/tmp/gradio/28c05ffed1543dac5e4fd4da07024515ab6ca820077f3ee27dd9fea6de6c6ced/075.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45358 - "GET /gradio_api/file%3D/tmp/gradio/c552b447c9c3357ebab7c687c63ea259ef202e73ff9f8c680f6737f1fe8b95be/101.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45336 - "GET /gradio_api/file%3D/tmp/gradio/b0ba9944a0b1665710a053236adca89adfbc4adafa1933a15b7ac23494053c21/1029.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45386 - "GET /gradio_api/file%3D/tmp/gradio/67eef160329658f47258a47c4a771bec3b1bdcdb3d7ab20dc5a923947a039d6d/1022.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45348 - "GET /gradio_api/file%3D/tmp/gradio/1195ebaa2734004da30d9f275fb5dde6ea4970fa0721135d4b933d5d438cbf48/1037.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45374 - "GET /gradio_api/file%3D/tmp/gradio/1b523c85da99b81830e464aad3c004c49e4c300a2f92dbb49c006892d7b91930/1079.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45374 - "GET /gradio_api/file%3D/tmp/gradio/22eaf5ac39a5f2f30b3d1565579b38839811a049b9951a600f93a4c73ff936ec/1111.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45348 - "GET /gradio_api/file%3D/tmp/gradio/232a64671030039dff1fd0c523c4ee0493925638802dbc67bae961783cfaaa81/1123.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45358 - "GET /gradio_api/file%3D/tmp/gradio/118851500bee21dae0341739573ec7a500562abf71243274eba640e34c3b83c9/1135.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45386 - "GET /gradio_api/file%3D/tmp/gradio/6837a29459c984c8b44193bf30c18d8fdf03c1db805213d2fb193e5cecf0d8e9/1128.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45336 - "GET /gradio_api/file%3D/tmp/gradio/0d56b98eff2474d89d04cb6d53cf33ec495d94617f7242cf8e906835fe571c92/1146.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45348 - "GET /static/fonts/system-ui/system-ui-Bold.woff2 HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:45374 - "GET /static/fonts/ui-sans-serif/ui-sans-serif-Bold.woff2 HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:45386 - "GET /gradio_api/file%3D/tmp/gradio/36ac1fe06cabbf1a7031d69099db72cdbb88d3d3f9c780b6eeef336b9f6fcef6/1148.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45348 - "GET /gradio_api/file%3D/tmp/gradio/d7a44d16ca75cdb06916e886dbe93c6395bb82ca1eb003f7a78d712a273296ed/1154.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:45374 - "GET /gradio_api/file%3D/tmp/gradio/4bb56346c949203f1d684c8cbd8f062337baf3c04d964c9cf19ae4f6019e7e57/1180.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:35308 - "GET /static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2 HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:35294 - "POST /gradio_api/run/predict HTTP/1.1" 200 OK
INFO: 127.0.0.1:35308 - "GET /static/fonts/ui-monospace/ui-monospace-Regular.woff2 HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:35294 - "POST /gradio_api/queue/join HTTP/1.1" 200 OK
INFO: 127.0.0.1:35294 - "GET /gradio_api/queue/data?session_hash=5imxe1t0rbl HTTP/1.1" 200 OK
INFO: 127.0.0.1:35308 - "GET /static/fonts/Consolas/Consolas-Regular.woff2 HTTP/1.1" 404 Not Found
Created new folder: ./save_dir/fe22c93b-0d0c-4603-af5a-d253af976911
Diffusion Sampling:: 100%|████████████████████████████████████████████████████████████| 30/30 [00:07<00:00, 3.90it/s]
Volume Decoding: 100%|███████████████████████████████████████████████████████████| 2122/2122 [00:04<00:00, 477.28it/s]
2025-07-21 18:01:52,440 - hy3dgen.shapgen - INFO - ---Shape generation takes 12.542610883712769 seconds ---
./save_dir/fe22c93b-0d0c-4603-af5a-d253af976911/white_mesh.glb

2025-07-21 18:01:54,943 - hy3dgen.shapgen - INFO - ---Face Reduction takes 2.4441030025482178 seconds ---
Traceback (most recent call last):
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/gradio/queueing.py", line 625, in process_events
response = await route_utils.call_process_api(
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/gradio/route_utils.py", line 322, in call_process_api
output = await app.get_blocks().process_api(
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/gradio/blocks.py", line 2218, in process_api
result = await self.call_function(
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/gradio/blocks.py", line 1729, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread
return await future
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 967, in run
result = context.run(func, *args)
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/gradio/utils.py", line 894, in wrapper
response = f(*args, **kwargs)
File "/home/vuaieo/Hunyuan3D-2.1/gradio_app.py", line 381, in generation_all
path_textured = tex_pipeline(mesh_path=path, image_path=image, output_mesh_path=text_path, save_glb=False)
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/home/vuaieo/Hunyuan3D-2.1/hy3dpaint/textureGenPipeline.py", line 180, in call
texture = self.view_processor.texture_inpaint(texture, mask_np)
File "/home/vuaieo/Hunyuan3D-2.1/./hy3dpaint/utils/pipeline_utils.py", line 132, in texture_inpaint
texture_np = self.render.uv_inpaint(texture, mask)
File "/home/vuaieo/miniconda3/envs/pyenv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/home/vuaieo/Hunyuan3D-2.1/./hy3dpaint/DifferentiableRenderer/MeshRender.py", line 1408, in uv_inpaint
texture_np, mask = meshVerticeInpaint(texture_np, mask, vtx_pos, vtx_uv, pos_idx, uv_idx)
NameError: name 'meshVerticeInpaint' is not defined
INFO: 127.0.0.1:52100 - "POST /gradio_api/queue/join HTTP/1.1" 200 OK
INFO: 127.0.0.1:52100 - "GET /gradio_api/queue/data?session_hash=5imxe1t0rbl HTTP/1.1" 200 OK
INFO: 127.0.0.1:46366 - "POST /gradio_api/queue/join HTTP/1.1" 200 OK
INFO: 127.0.0.1:46366 - "GET /gradio_api/queue/data?session_hash=5imxe1t0rbl HTTP/1.1" 200 OK"

the AI told me to use the command "export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True" before runnig the gradio app, but it didnt help.

PLEASE can someone help me how i can solve it to generate textured model? i not a programmer or scientist to understand this all. dunnno what to do anymore T__T

i using 5090 with nvidia 575.64.03 drivers and nvcc is:

"nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
"
if that info helps in some way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions