Skip to content

[Bug]: foreign_class not working with auth token #1678

Description

@liaspas

Describe the bug

Hello,
I am trying to load a custom encoder from a private HuggingFace model with foreign_class but am faced with the following issues.

  1. It seems use_auth_token is not properly passed here:

    hparams_local_path = fetch(hparams_file, source, savedir, use_auth_token)
    pymodule_local_path = fetch(pymodule_file, source, savedir, use_auth_token)

    That is because use_auth_token is the sixth parameter in fetch and as such should be called like:

    fetch(hparams_file, source, savedir, use_auth_token=use_auth_token)
    

    By changing that I was able to download the custom encoder.py and hyperparams.yaml

  2. Authentication fails again while trying to fetch the model checkpoints during collect_files of the Pretrainer:

    path = fetch(
    filename, source, self.collect_in, save_filename=save_filename
    )

    Where there seems to be no option to pass the auth token.

Expected behaviour

Passing the HuggingFace access token in foreign_class(..., use_auth_token={token}) should authenticate and download the required files.

To Reproduce

No response

Versions

speechbrain==0.5.13

Relevant log output

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions