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

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

Open
HHLiufighting opened this issue Jun 19, 2024 · 1 comment

Comments

@HHLiufighting
Copy link

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

@c7w
Copy link

c7w commented Jun 24, 2024

        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.

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