Skip to content

Add trust_remote_code=True to load some specific models from huggingface #2207

Open

Description

@Adefioye

There are some models that require trust_remote_code=True. This prevents repetitive prompting to press Y/N on the terminal to load the models every time it is being loaded. A typical use case is when encoding queries and searching from a precomputed index of documents/passages using AutoQueryEncoder.

Example of model requiring this argument can be found below and here is link:

tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
model = AutoModel.from_pretrained('nomic-ai/nomic-embed-text-v1', trust_remote_code=True)

I need this as I am currently running some evals for these models on a cloud gpu using pyserini.

Please let me know if I can quickly whip up a PR to at least add it in for AutoQueryEncoder and perhaps other places where AutoModel.from_pretained(model) is being used currently.

Activity

  1. changed the title [-]Add `trust_remote_code=True` to load models from huggingface[/-] [+]Add `trust_remote_code=True` to load some specific models from huggingface[/+] on Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions