# Deploy big model to AWS Sagemaker fails

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdeploy-big-model-to-aws-sagemaker-fails%2F39089%3E%5C
**Category:** Beginners\
**Created:** [May 8, 2023, 11:50am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdeploy-big-model-to-aws-sagemaker-fails%2F39089 "2023-05-08T11:50:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rabah9](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@Rabah9](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FRabah9)%5C
**Post date:** [May 8, 2023, 11:50am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdeploy-big-model-to-aws-sagemaker-fails%2F39089%2F1 "2023-05-08T11:50:03Z")

</div>

Hello,  
I’m trying to deploy a model on AWS Sagemake ([mosaicml/mpt-7b-chat · Hugging Face](https://huggingface.co/mosaicml/mpt-7b-chat))

I used the code generated by the model’s page for a quick start, it is as follow:

```auto
from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
    'HF_MODEL_ID':'mosaicml/mpt-7b-chat',
    'HF_TASK':'text-generation'
}

# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
    transformers_version='4.17.0',
    pytorch_version='1.10.2',
    py_version='py38',
    env=hub,
    role=role, 
)

# deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
    initial_instance_count=1, # number of instances
    instance_type='ml.m5.xlarge' # ec2 instance type
)

predictor.predict({
    'inputs': "Can you please let us know more details about your "
})

```

The code crashes at the “predict” call with this error: Loading /.sagemaker/mms/models/mosaicml\_\_mpt-7b-chat 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\u003dTrue` to remove this error.

I had the same issue locally that I fixed by adding the " trust\_remote\_code=True" parameter to the AutoModelForCausalLM.from\_pretrained constructor, but that doesn’t seem to exist with HuggingFaceModel constructor.

Any way to fix this? thank you

---

<div class="post-metadata">

**Author:** ![benparfitt](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@benparfitt](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbenparfitt)%5C
**Post date:** [May 13, 2023, 10:57pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdeploy-big-model-to-aws-sagemaker-fails%2F39089%2F2 "2023-05-13T22:57:57Z")

</div>

I had the same issue! Were you able to fix this?

---

<div class="post-metadata">

**Author:** ![Malathy](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Malathy](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMalathy)%5C
**Post date:** [May 19, 2023, 2:46am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdeploy-big-model-to-aws-sagemaker-fails%2F39089%2F3 "2023-05-19T02:46:27Z")

</div>

I am facing the same issue. Any input on how to fix it?

---

<div class="post-metadata">

**Author:** ![kennethleungty](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@kennethleungty](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fkennethleungty)%5C
**Post date:** [May 28, 2023, 9:14am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdeploy-big-model-to-aws-sagemaker-fails%2F39089%2F4 "2023-05-28T09:14:08Z")

</div>

Anyone with any solution for this? Seems like it is still not resolved

---

<div class="post-metadata">

**Author:** ![pathlight-rushil](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pathlight-rushil/32/16336_2.png) [@pathlight-rushil](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpathlight-rushil)%5C
**Post date:** [June 5, 2023, 3:27pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdeploy-big-model-to-aws-sagemaker-fails%2F39089%2F5 "2023-06-05T15:27:51Z")

</div>

this medium article allowed me to deploy successfully [Deploy MosaicML MPT-7B-Instruct on SageMaker | by Manoranjan Rajguru | May, 2023 | Medium](https://medium.com/@manoranjan.rajguru/deploy-mosaicml-mpt-7b-instruct-on-sagemaker-54730f88729b)

---

<div class="post-metadata">

**Author:** ![suchitavenugopal](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@suchitavenugopal](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsuchitavenugopal)%5C
**Post date:** [July 31, 2023, 11:17pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdeploy-big-model-to-aws-sagemaker-fails%2F39089%2F6 "2023-07-31T23:17:43Z")

</div>

Was anyone able to fix this issue? Looks like this issue exists for all mosaicml/mpt-7b-\* models. Is that right?
