FileNotFoundError: Model path tencent/Hunyuan3D-2 not found and we could not find it at huggingface
Hello and thank you for open sourcing these models!
I've been trying to run the api_server.py as well as ComfyUI nodes from this repo. In both cases I keep having the same error with the texture generation module.
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | Traceback (most recent call last):
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | File "/usr/app/Hunyuan3D-2/api_server.py", line 272, in <module>
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | worker = ModelWorker(model_path=args.model_path, device=args.device)
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | File "/usr/app/Hunyuan3D-2/api_server.py", line 142, in __init__
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | self.pipeline_tex = Hunyuan3DPaintPipeline.from_pretrained(model_path)
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | File "/usr/app/Hunyuan3D-2/hy3dgen/texgen/pipelines.py", line 86, in from_pretrained
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | raise FileNotFoundError(f"Model path {original_model_path} not found and we could not find it at huggingface")
hunyuan3d | 2025-02-01 11:44:32 | ERROR | stderr | FileNotFoundError: Model path tencent/Hunyuan3D-2 not found and we could not find it at huggingface
My model files seem to be properly downloaded, I have this:
I looked into your code and I noticed the function Hunyuan3DPaintPipeline.from_pretrained always raises a FileNotFoundError line 86. Is it normal? https://github.com/Tencent/Hunyuan3D-2/blob/main/hy3dgen/texgen/pipelines.py#L86
class Hunyuan3DPaintPipeline:
@classmethod
def from_pretrained(cls, model_path):
original_model_path = model_path
if not os.path.exists(model_path):
# try local path
base_dir = os.environ.get('HY3DGEN_MODELS', '~/.cache/hy3dgen')
model_path = os.path.expanduser(os.path.join(base_dir, model_path))
delight_model_path = os.path.join(model_path, 'hunyuan3d-delight-v2-0')
multiview_model_path = os.path.join(model_path, 'hunyuan3d-paint-v2-0')
if not os.path.exists(delight_model_path) or not os.path.exists(multiview_model_path):
try:
import huggingface_hub
# download from huggingface
model_path = huggingface_hub.snapshot_download(repo_id=original_model_path)
delight_model_path = os.path.join(model_path, 'hunyuan3d-delight-v2-0')
multiview_model_path = os.path.join(model_path, 'hunyuan3d-paint-v2-0')
return cls(Hunyuan3DTexGenConfig(delight_model_path, multiview_model_path))
except ImportError:
logger.warning(
"You need to install HuggingFace Hub to load models from the hub."
)
raise RuntimeError(f"Model path {model_path} not found")
else:
return cls(Hunyuan3DTexGenConfig(delight_model_path, multiview_model_path))
raise FileNotFoundError(f"Model path {original_model_path} not found and we could not find it at huggingface")
How can I solve this issue please?
It probably occur some exception in try block, which is not an import error. Could you try to comment out the catch block to see what error occurs?
非常有意思的代码逻辑 if not os.path.exists(model_path): …… raise FileNotFoundError(f"Model path {original_model_path} not found and we could not find it at huggingface")
如果路径存在,那么抛异常😂
it should be written as
try:
import huggingface_hub
except ImportError:
logger.warning(
"You need to install HuggingFace Hub to load models from the hub."
)
raise RuntimeError(f"Model path {model_path} not found")
else:
# download from huggingface
model_path = huggingface_hub.snapshot_download(repo_id=original_model_path)
delight_model_path = os.path.join(model_path, 'hunyuan3d-delight-v2-0')
multiview_model_path = os.path.join(model_path, 'hunyuan3d-paint-v2-0')
return cls(Hunyuan3DTexGenConfig(delight_model_path, multiview_model_path))
same issue
same
same issue
same issue
Same issue
I too am experiencing this issue, however it's with the API. I've downloaded the model, place it in ./tencent/Hunyuan3d-2. I've even tried to update the script with a full path.
facing the same issue.
same
I was having the same issue, and it was because I was using an outdated fork. The problem appears to have been fixed in https://github.com/Tencent-Hunyuan/Hunyuan3D-2/commit/8efbe53a7e09bffb3efc71045147afd0bbd149d4
no, it's not solved. That commit is in another file (texgen instead of shapegen).
If you pass a --model_path to api_server.py that you haven't downloaded already, it won't be able to resolve because the subfolder in api_server.py doesn't exist:
subfolder='hunyuan3d-dit-v2-mini-turbo'
https://huggingface.co/tencent/Hunyuan3D-2/tree/main
there's currently no way to pass a subfolder to api_server.py via args
if you can modify the api_server.py
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--host", type=str, default="0.0.0.0")
parser.add_argument("--port", type=int, default=8081)
parser.add_argument("--model_path", type=str, default='tencent/Hunyuan3D-2mini')
parser.add_argument("--tex_model_path", type=str, default='tencent/Hunyuan3D-2')
parser.add_argument('--subfolder', type=str, default="hunyuan3d-dit-v2-mini-turbo")
parser.add_argument("--device", type=str, default="cuda")
parser.add_argument("--limit-model-concurrency", type=int, default=5)
parser.add_argument('--enable_tex', action='store_true')
args = parser.parse_args()
logger.info(f"args: {args}")
model_semaphore = asyncio.Semaphore(args.limit_model_concurrency)
worker = ModelWorker(model_path=args.model_path, device=args.device, enable_tex=args.enable_tex,
tex_model_path=args.tex_model_path, subfolder=args.subfolder)
uvicorn.run(app, host=args.host, port=args.port, log_level="info")
and then call
python3 api_server.py \
--host 0.0.0.0 \
--port 8080 \
--enable_tex \
--model_path tencent/Hunyuan3D-2 \
--subfolder hunyuan3d-dit-v2-0-turbo \
--tex_model_path tencent/Hunyuan3D-2
as you can see I changed subfolder from hunyuan3d-dit-v2-mini-turbo to hunyuan3d-dit-v2-0-turbo
same issue