# Removal of assert from phi-3-small init

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fremoval-of-assert-from-phi-3-small-init%2F102957%3E%5C
**Category:** Models\
**Created:** [August 19, 2024, 9:31am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fremoval-of-assert-from-phi-3-small-init%2F102957 "2024-08-19T09:31:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerfeng](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rogerfeng](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frogerfeng)%5C
**Post date:** [August 19, 2024, 9:31am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fremoval-of-assert-from-phi-3-small-init%2F102957%2F1 "2024-08-19T09:31:34Z")

</div>

When enabling phi-3-small on non-cuda devices, the assert of flash\_attn package’s availability in **init** makes it difficult to run w/o modeling script changes. Can we replace the assert with a warning message? In this way it offers a chance for modeling to be replaced afterwards with alternative implementations of flash\_attn.

> **[modeling\_phi3\_small.py · microsoft/Phi-3-small-8k-instruct at main](https://huggingface.co/microsoft/Phi-3-small-8k-instruct/blob/main/modeling_phi3_small.py#L218)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<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 19, 2024, 12:00pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fremoval-of-assert-from-phi-3-small-init%2F102957%2F2 "2024-08-19T12:00:21Z")

</div>

Hi,

Phi-3 is available natively in the Transformers library, hence please use `from_pretrained` without specifying `trust_remote_code=True`.

Docs: [Phi-3](https://huggingface.co/docs/transformers/en/model_doc/phi3)

---

<div class="post-metadata">

**Author:** ![rogerfeng](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rogerfeng](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frogerfeng)%5C
**Post date:** [August 20, 2024, 7:40am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fremoval-of-assert-from-phi-3-small-init%2F102957%2F3 "2024-08-20T07:40:53Z")

</div>

Thanks Niels. With transformers.from\_pretrained(trust\_remote\_code=False), phi-3-small seems insistently asking to set it as True. Do you know any plan for transformers to support phi3-small natively? Seeking for a way to mitigate the assertion in the **init** function of the original modeling script.

Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] on linux  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import torch  
> > > from transformers import AutoModelForCausalLM  
> > > model=“microsoft/Phi-3-small-8k-instruct”  
> > > model = AutoModelForCausalLM.from\_pretrained(model, torch\_dtype=“auto”, trust\_remote\_code=False)  
> > > config.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.57k/1.57k [00:00\<00:00, 15.7MB/s]  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > File “/home/xfeng8/miniforge3/lib/python3.10/site-packages/transformers/models/auto/auto\_factory.py”, line 524, in from\_pretrained  
> > > config, kwargs = AutoConfig.from\_pretrained(  
> > > File “/home/xfeng8/miniforge3/lib/python3.10/site-packages/transformers/models/auto/configuration\_auto.py”, line 979, in from\_pretrained  
> > > trust\_remote\_code = resolve\_trust\_remote\_code(  
> > > File “/home/xfeng8/miniforge3/lib/python3.10/site-packages/transformers/dynamic\_module\_utils.py”, line 640, in resolve\_trust\_remote\_code  
> > > raise ValueError(  
> > > ValueError: Loading microsoft/Phi-3-small-8k-instruct requires you to execute the configuration 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.

$ pip list|grep transformers  
transformers 4.44.0
