# How to avoid \`trust\_remote\_code=True\` for my models

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134%3E%5C
**Category:** 🤗Transformers\
**Created:** [April 28, 2024, 7:13am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134 "2024-04-28T07:13:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammad2003](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/muhammad2003/32/26308_2.png) [@Muhammad2003](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMuhammad2003)%5C
**Post date:** [April 28, 2024, 7:13am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134%2F1 "2024-04-28T07:13:43Z")

</div>

Hey , one of my orpo tuned model needs `trust_remote_code=True` , due to which i cannot submit to the leaderboards … what’s responsible for this and how can i omit this dependency … my model has 2 safe-tensors and no python script explicitly in the repo

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [April 28, 2024, 10:10am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134%2F2 "2024-04-28T10:10:35Z")

</div>

Hi,

The `trust_remote_code=True` flag is used for models whose code lives on the hub rather than natively in the Transformers library.

Models with that flag are created based on this guide: [Building custom models](https://huggingface.co/docs/transformers/custom_models)

---

<div class="post-metadata">

**Author:** ![Muhammad2003](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/muhammad2003/32/26308_2.png) [@Muhammad2003](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMuhammad2003)%5C
**Post date:** [April 28, 2024, 10:49am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134%2F3 "2024-04-28T10:49:52Z")

</div>

is there anyway i can fix it?  
I used the same training script to train llama-orpo which is fine but for training phi3-orpo, it created this dependency.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [April 28, 2024, 11:24am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134%2F4 "2024-04-28T11:24:42Z")

</div>

For that, Phi-3 would need to be integrated natively in the Transformers library.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [June 11, 2024, 5:16pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134%2F5 "2024-06-11T17:16:53Z")

</div>

Update, Phi-3 is now in Transformers as of version 4.40.

---

<div class="post-metadata">

**Author:** ![Archan](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/archan/32/28312_2.png) [@Archan](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FArchan)%5C
**Post date:** [August 21, 2024, 12:43pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134%2F6 "2024-08-21T12:43:32Z")

</div>

Hi I am currently using the [Phi3 Vision Instruct](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct), and I am getting the same issue. when I try to deploy it using flask/fastapi it is asking me to prompt yes. Now when the server auto restarts and the prompt is not given in the terminal, it closes the entire operation.

Anyway we can bypass it or do something before this model is moved natively into transformers

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [August 26, 2024, 1:47pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-avoid-trust-remote-code-true-for-my-models%2F84134%2F7 "2024-08-26T13:47:05Z")

</div>

Hi @Archan,

Could you clarify why it is prompting you? I assume that if you deploy this model on your backend, you would have loaded the model already with `trust_remote_code=True`.

Also for deployment of Phi-3 Vision, you might be interested in the vLLM deployment: [Supported Models — vLLM](https://docs.vllm.ai/en/latest/models/supported_models.html#multimodal-language-models).
