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

Loading a pipeline with trust_remote_code=True raises warning #36273

Open
4 tasks
tcapelle opened this issue Feb 19, 2025 · 1 comment · May be fixed by #36285
Open
4 tasks

Loading a pipeline with trust_remote_code=True raises warning #36273

tcapelle opened this issue Feb 19, 2025 · 1 comment · May be fixed by #36285
Labels

Comments

@tcapelle
Copy link

System Info

Doing

from transformers import pipeline

pipe = pipeline(
    task="custom-task",
    model=local_model_path,
    trust_remote_code=True,
)

raises a warning:

The argument `trust_remote_code` is to be used with Auto classes. It has no effect here and is ignored.

but if we remove it, ad the pipeline actually needs to load a custom pipeline or model, you get an error.

pipe = pipeline(
    task="custom-task",
    model=local_model_path,
    # trust_remote_code=True,
)

ValueError: Loading this pipeline requires you to execute the code in the pipeline file in that repo on your local machine. Make sure you have read the code there to avoid malicious use, then set the option `trust_remote_code=True` to remove this error.

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Above

Expected behavior

Should not raise a warning.

@tcapelle tcapelle added the bug label Feb 19, 2025
@Rocketknight1 Rocketknight1 linked a pull request Feb 19, 2025 that will close this issue
@Rocketknight1
Copy link
Member

Thanks for the report! Opened a PR to fix it at #36285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants