Issue loading texture generator (texgen_worker) in Hunyuan3D-2 (NameError and missing .safetensors)

#6
by tripl3wave - opened

I'm using Hunyuan3D-2 locally on Windows, but the texture generator never loads. The script tries to call texgen_worker, yet it’s not defined (NameError). Also, Hugging Face creates zero-byte .symlink files instead of actual .safetensors for hunyuan3d-paint-v2-0. After a full download, I still get "Failed to load texture generator. Model path not found."

Has anyone resolved this? I’ve tried:

Logging in via huggingface-cli.
Deleting the model cache to force re-download.
Checking requirements.txt.
Still no luck with the texture pipeline. Any fixes or workarounds to properly initialize texgen_worker on Windows? Thanks!

The symlinks would indicate that you're missing git LFS which you can google and install. It pulled the references instead of replacing them with the large files. Pulling the whole repo with LFS was 36gb.

Did you get it working? I finally managed to get Hunyuan3D-2 to work on my local computer but generating textures with the mesh is not working

downloading and installing "git" and then "git lfs" worked fine for me

Hi it gives this message but the texturing does not work
Microsoft Windows [Version 10.0.19045.5487]
(c) Microsoft Corporation. TΓΌm haklarΔ± saklΔ±dΔ±r.

E:\yapay zeka\3d\Hunyuan3D-2-main\Hunyuan3D-2-main>python gradio_app.py
C:\Users\Furkan\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio_client\documentation.py:106: UserWarning: Could not get documentation group for <class 'gradio.mix.Parallel'>: No known documentation group for module 'gradio.mix'
warnings.warn(f"Could not get documentation group for {cls}: {exc}")
C:\Users\Furkan\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio_client\documentation.py:106: UserWarning: Could not get documentation group for <class 'gradio.mix.Series'>: No known documentation group for module 'gradio.mix'
warnings.warn(f"Could not get documentation group for {cls}: {exc}")
Loading example img list ...
Loading example txt list ...
A matching Triton is not available, some optimizations will not be enabled
Traceback (most recent call last):
File "C:\Users\Furkan\AppData\Local\Programs\Python\Python311\Lib\site-packages\xformers_init_.py", line 57, in _is_triton_available
import triton # noqa
^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'triton'
Fetching 48 files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 48/48 [00:00<00:00, 12005.88it/s]
Loading pipeline components...: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 6/6 [00:00<00:00, 6.52it/s]
Loading pipeline components...: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 6/6 [00:08<00:00, 1.42s/it]
Loading pipeline components...: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 6/6 [00:01<00:00, 3.55it/s]
Try to load model from local path: C:\Users\Furkan/.cache/hy3dgen\tencent/Hunyuan3D-2\hunyuan3d-dit-v2-0
Model path not exists, try to download from huggingface
Fetching 48 files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 48/48 [00:00<00:00, 6859.28it/s]
INFO: Started server process [12964]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
IMPORTANT: You are using gradio version 3.39.0, however version 4.44.1 is available, please upgrade.

INFO: 127.0.0.1:55917 - "GET / HTTP/1.1" 200 OK
INFO: 127.0.0.1:55917 - "GET /info HTTP/1.1" 200 OK
INFO: 127.0.0.1:55917 - "GET /theme.css HTTP/1.1" 200 OK
INFO: 127.0.0.1:55917 - "POST /run/predict HTTP/1.1" 200 OK
mkdir gradio_cache/12 success !!!
RGBA
Using border_ratio from init: 0.15
Diffusion Sampling:: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 30/30 [00:05<00:00, 5.86it/s]
MC Level 0.0 Implicit Function:: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2122/2122 [00:06<00:00, 320.51it/s]
Find html file gradio_cache/12\white_mesh.html, True, relative HTML path is /static/12\white_mesh.html

It is taking forever to complete. I have enough ram and vram for this.

Same for me. Mesh is generated correctly then hangs forever.

I found the problem on my side. In pipelines.py -> Hunyuan3DPaintPipeline.__call__(), after generating multi-view images, there is a step to invoke 'stabilityai/stable-diffusion-x4-upscaler' for upsampling. On my machine, this step seems to have fallen back to some single-threaded CPU path. I just skipped this step, and everything is fine (except the tex resolution is...actually good enough?).

Around line 211:

        multiviews = self.models['multiview_model'](image_prompt, normal_maps + position_maps, camera_info)

        for i in range(len(multiviews)):
            # πŸ‘‡Comment this line:
            # multiviews[i] = self.models['super_model'](multiviews[i])
            multiviews[i] = multiviews[i].resize(
                (self.config.render_size, self.config.render_size))

        texture, mask = self.bake_from_multiview(multiviews,
                                                 selected_camera_elevs, selected_camera_azims, selected_view_weights,
                                                 method=self.config.merge_method)

There are lots of pipelines.py in the folder. Which one should be changed ?

Hunyuan3D-2-main\Hunyuan3D-2-main\hy3dgen\texgen
Hunyuan3D-2-main\Hunyuan3D-2-main\build\lib\hy3dgen\texgen

I changed both of them and worked. But yes quality of the texture is low.

Hunyuan3D-2-main\Hunyuan3D-2-main\hy3dgen\texgen
Hunyuan3D-2-main\Hunyuan3D-2-main\build\lib\hy3dgen\texgen

I changed both of them and worked. But yes quality of the texture is low.

Hunyuan3D-2-main\Hunyuan3D-2-main\hy3dgen\texgen
Hunyuan3D-2-main\Hunyuan3D-2-main\build\lib\hy3dgen\texgen

Yes, this will disable texture upscaling.
I found that I can change hy3dgen/texgen/pipelines.py -> class Hunyuan3DTexGenConfig.__init__() to self.device = 'cpu' to self.device = 'cuda' to use the GPU path, although it still takes a long time to upscale.

Thanks I will try this and share the results.

After disabling the upscaling it takes 1-2 minutes to create a model.

image.png

I get textures from an Image Prompt without issue personally. But from a Text Prompt, all I get is a mesh.
There's also, for Text Prompt, a "Generated Textured Mesh" tab, so I guess it should work?

I was able to generate textured mesh with text prompt. By using this method

This is the mesh

image.png

I found the problem on my side. In pipelines.py -> Hunyuan3DPaintPipeline.__call__(), after generating multi-view images, there is a step to invoke 'stabilityai/stable-diffusion-x4-upscaler' for upsampling. On my machine, this step seems to have fallen back to some single-threaded CPU path. I just skipped this step, and everything is fine (except the tex resolution is...actually good enough?).

Around line 211:

        multiviews = self.models['multiview_model'](image_prompt, normal_maps + position_maps, camera_info)

        for i in range(len(multiviews)):
            # πŸ‘‡Comment this line:
            # multiviews[i] = self.models['super_model'](multiviews[i])
            multiviews[i] = multiviews[i].resize(
                (self.config.render_size, self.config.render_size))

        texture, mask = self.bake_from_multiview(multiviews,
                                                 selected_camera_elevs, selected_camera_azims, selected_view_weights,
                                                 method=self.config.merge_method)

Sign up or log in to comment