Cannot generate model, `'ModelWorker' object has no attribute 'pipeline_t2i'`
I run this on a Linux system and I installed the software by cloning the git repository and installing the dependencies, as explained in the readme.
The server is started as python api_server.py --host 0.0.0.0 --port 9124. When I try to render something via the Blender add-on, the server receives the request but fails:
INFO: Uvicorn running on http://0.0.0.0:9124 (Press CTRL+C to quit)
Worker generating...
Caught Unknown Error 'ModelWorker' object has no attribute 'pipeline_t2i'
Traceback (most recent call last):
File "/home/Hunyuan3D-2/api_server.py", line 250, in generate
file_path, uid = worker.generate(uid, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/Hunyuan3D-2/venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/Hunyuan3D-2/api_server.py", line 194, in generate
image = self.pipeline_t2i(text)
^^^^^^^^^^^^^^^^^
AttributeError: 'ModelWorker' object has no attribute 'pipeline_t2i'
127.0.0.1:49140 - "POST /generate HTTP/1.1" 404 Not Found
When I ran it for the first time, it downloaded some models (several GB in size) - so I assume that the prerequisites are in place.
How can I troubleshoot this problem?
Having looked at the code, I see why this happens - there is a piece of commented code in api_server.py and self.pipeline_t2i really doesn't exist:
- # self.pipeline_t2i = HunyuanDiTPipeline(
- # 'Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers-Distilled',
- # device=device
- # )
If I uncomment it manually and run the server, it runs but fails when I try to generate the model via the Blender plugin. It seems that it needs another dependency, so one must pip install sentencepiece, but this library depends on another library called diso - which I couldn't install easily.
@Zeqiang-Lai, can you provide some guidance?
https://github.com/Tencent/Hunyuan3D-2/blob/38cf8fb09bef0abd5105ff6d951e1fe9e992db82/api_server.py#L165C9-L165C52
Are you using the latest code? If it is self.pipeline.enable_flashvdm(mc_algo='mc') The api server should be able to run without diso.
Yes, I just pulled the new version, I'm currently at this commit
commit 38cf8fb09bef0abd5105ff6d951e1fe9e992db82 (HEAD -> main, origin/main, origin/HEAD)
Merge: b8d6b65 d298c04
Author: Zeqiang Lai
Date: Wed Mar 26 19:38:23 2025 +0800
And the code indeed says mc_algo='mc'.
Should I uncomment the lines related to self.pipeline_t2i ?
you don't need pipeline_t2i as long as you don't use text to 3D. leave it commented and you can still use image to 3D without problem
I see, I was using text to 3D using the Blender plugin. I gave it a try with the image to text approach (also via Blender) and it still doesn't work:
controller | Worker generating...
hy3dgen.shapgen - INFO - The parameters `mc_algo` is deprecated, and will be removed in future versions.
Please use:
from hy3dgen.shapegen.models.autoencoders import SurfaceExtractors
pipeline.vae.surface_extractor = SurfaceExtractors[mc_algo]() instead
hy3dgen.shapgen | The parameters `mc_algo` is deprecated, and will be removed in future versions.
Please use:
from hy3dgen.shapegen.models.autoencoders import SurfaceExtractors
pipeline.vae.surface_extractor = SurfaceExtractors[mc_algo]() instead
Diffusion Sampling:: 100%|█████████████████████████████████████████████████████| 20/20 [00:02<00:00, 8.47it/s]
2025-03-28 09:27:41,336 - hy3dgen.shapgen - INFO - FlashVDMVolumeDecoding Resolution: [63, 126, 252]
FlashVDMVolumeDecoding Resolution: [63, 126, 252]
FlashVDM Volume Decoding: 0%| | 0/64 [00:00<?, ?it/s]
FlashVDM Volume Decoding: 100%|██████████████████████████████████████████████| 64/64 [00:00<00:00, 2170.10it/s]
Traceback (most recent call last):
File "Hunyuan3D-2/hy3dgen/shapegen/models/autoencoders/surface_extractors.py", line 84, in run
from diso import DiffDMC
ModuleNotFoundError: No module named 'diso'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Hunyuan3D-2/hy3dgen/shapegen/models/autoencoders/surface_extractors.py", line 54, in __call__
vertices, faces = self.run(grid_logits[i], **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "Hunyuan3D-2/hy3dgen/shapegen/models/autoencoders/surface_extractors.py", line 86, in run
raise ImportError("Please install diso via `pip install diso`, or set mc_algo to 'mc'")
ImportError: Please install diso via `pip install diso`, or set mc_algo to 'mc'
--- 3.1481428146362305 seconds ---
Caught Unknown Error 'NoneType' object has no attribute 'export'
Traceback (most recent call last):
File "Hunyuan3D-2/api_server.py", line 250, in generate
file_path, uid = worker.generate(uid, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "Hunyuan3D-2/venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "Hunyuan3D-2/api_server.py", line 223, in generate
mesh.export(temp_file.name)
^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'export'
INFO: 127.0.0.1:51068 - "POST /generate HTTP/1.1" 404 Not Found
Note that it still says it needs diso and says "or set mc_algo to mc" - even though mc_algo is already set to mc: self.pipeline.enable_flashvdm(mc_algo='mc').
What else could I try?
Ok, I see. change this line
https://github.com/Tencent/Hunyuan3D-2/blob/54b7eab96c31894c7fa884ee8aac5ed44dc482d5/api_server.py#L209
dmc to mc
Sorry about confusion.
That works, thank you. Is this a permanent change that should be part of the repository, or just a temporary hack?
Great! I have changed it to mc by default since diso is difficult to install.