3DTopia / OpenLRM

An open-source impl. of Large Reconstruction Models
Apache License 2.0
972 stars 56 forks source link

TypeError: __init__() missing 1 required positional argument: 'config' #52

Open HHLiufighting opened 5 months ago

HHLiufighting commented 5 months ago

TypeError: init() missing 1 required positional argument: 'config' How should I solve this error?

c7w commented 4 months ago
        model_id = str(pretrained_model_name_or_path)
        config_file: Optional[str] = None
        if os.path.isdir(model_id):
            if CONFIG_NAME in os.listdir(model_id):
                config_file = os.path.join(model_id, CONFIG_NAME)
            else:
                logger.warning(f"{CONFIG_NAME} not found in {Path(model_id).resolve()}")
        else:
            try:
                config_file = hf_hub_download(
                    repo_id=model_id,
                    filename=CONFIG_NAME,
                    revision=revision,
                    cache_dir=cache_dir,
                    force_download=force_download,
                    proxies=proxies,
                    resume_download=resume_download,
                    token=token,
                    local_files_only=local_files_only,
                )
            except HfHubHTTPError as e:
                logger.info(f"{CONFIG_NAME} not found on the HuggingFace Hub: {str(e)}")

I had the same problem with you. I found that inside the huggingface_hub libraries (L438-459, hub_mixin.py), config_file is None after executing these lines. (And it didn't trigger the Except block as it raised an exception with type LocalEntryNotFoundError, but not HfHubHTTPError). Using a proxy may help.

KindofCrazy commented 3 weeks ago

Maybe you are enconutered with the fairwall. You can change the constants.py in the huggingface_hub library of your environment as below.

# _HF_DEFAULT_ENDPOINT = "https://huggingface.co"
_HF_DEFAULT_ENDPOINT = "https://hf-mirror.com"