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

FileNotFoundError: Model path tencent/Hunyuan3D-2 not found and we could not find it at huggingface #71

Open
alexisrolland opened this issue Feb 1, 2025 · 1 comment

Comments

@alexisrolland
Copy link

alexisrolland commented Feb 1, 2025

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:

Image

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?

@Zeqiang-Lai
Copy link
Collaborator

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?

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

2 participants