# Model works but MultiDataModel doesn't

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%3E%5C
**Category:** Amazon SageMaker\
**Created:** [July 20, 2021, 8:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530 "2021-07-20T20:28:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsunadawong](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@wsunadawong](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwsunadawong)%5C
**Post date:** [July 20, 2021, 8:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F1 "2021-07-20T20:28:13Z")

</div>

This is a continuation of my post [here](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-deploying-bert-on-sagemaker%2F8401). I’m trying to deploy BERT for text classification with tensorflow. When I use the model.deploy() method, I can successfully get inferences from BERT. Here’s my problem: I have four different models for classification and I want to run them on the same instance, not multiple instances, to save on cost. So I tried using the MultiDataModel class, but I keep getting the following error:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/e/ecf991942209c779f2cddd0fecd2065f701516f0.png)

The CloudWatch logs don’t add any additional information, unfortunately. Here’s the structure of counterargument.tar.gz in the s3 bucket, which I cloned from my [HuggingFace account](https://huggingface.co/wsunadawong/counterargument_hugging) and zipped.

```auto
counterargument.tar.gz
    config.json
    special_tokens_map.json
    tf_model.h5
    tokenizer.json
    tokenizer_config.json
    vocab.txt

```

The most puzzling thing about this error is that model.deploy() worked fine, but multi\_model.deploy() doesn’t! Thanks in advance.

---

<div class="post-metadata">

**Author:** ![philschmid](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/philschmid/32/38022_2.png) [@philschmid](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fphilschmid)%5C
**Post date:** [July 21, 2021, 7:11am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F2 "2021-07-21T07:11:49Z")

</div>

@wsunadawong when using Multi-Model-Endpoints SageMaker stores the models differently. That’s why `model.deploy()` seems to work and MME does not. We (Amazon & HF) are looking into it. Hopefully, we can come back with a fix as soon as possible!

---

<div class="post-metadata">

**Author:** ![dan21c](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dan21c/32/115_2.png) [@dan21c](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdan21c)%5C
**Post date:** [July 21, 2021, 4:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F3 "2021-07-21T16:19:13Z")

</div>

Could you share logs from the endpoint’s cloudwatch logs? Also, the counterargument.tar.gz is a flat directory or does that tar have a directory inside which these files exist?

---

<div class="post-metadata">

**Author:** ![wsunadawong](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@wsunadawong](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwsunadawong)%5C
**Post date:** [July 21, 2021, 4:20pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F4 "2021-07-21T16:20:36Z")

</div>

The counterargument.tar.gz has a flat directory structure. I git cloned my huggingface repo and just zipped it. Here’s a picture of the contents:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/a/a03948004c4fa4e6142c9eb7875309c9c828dc66.png)

---

<div class="post-metadata">

**Author:** ![wsunadawong](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@wsunadawong](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwsunadawong)%5C
**Post date:** [July 21, 2021, 4:24pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F5 "2021-07-21T16:24:46Z")

</div>

And here’s a picture of the logs

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/a/abc87e1c868d891a5ae041de3f276d5919d3ac22.png)

---

<div class="post-metadata">

**Author:** ![dan21c](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dan21c/32/115_2.png) [@dan21c](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdan21c)%5C
**Post date:** [July 21, 2021, 8:07pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F7 "2021-07-21T20:07:44Z")

</div>

Could you share more of the log. I see that “Model `model` loaded” message. I want to understand where invocation failed.

---

<div class="post-metadata">

**Author:** ![wsunadawong](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@wsunadawong](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwsunadawong)%5C
**Post date:** [July 21, 2021, 8:13pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F8 "2021-07-21T20:13:02Z")

</div>

Here’s the logs which were above what I sent. There’s nothing useful below–just ping messages.

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/e/e660c6cc331ad5ff72dd44646db245cf65ca24e5.png)

---

<div class="post-metadata">

**Author:** ![wsunadawong](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@wsunadawong](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwsunadawong)%5C
**Post date:** [July 21, 2021, 8:25pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F9 "2021-07-21T20:25:19Z")

</div>

Oh my mistake, there were more non-ping logs below. Is this what you were looking for?

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/7/70398ad9217181315d180986dfa91b9b0d09983a.png)

---

<div class="post-metadata">

**Author:** ![dan21c](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dan21c/32/115_2.png) [@dan21c](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdan21c)%5C
**Post date:** [July 22, 2021, 12:10am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F10 "2021-07-22T00:10:22Z")

</div>

The container seems to be using default model directory to lookup for model instead of MME platforms model directory. We will try to reproduce this and get back.

---

<div class="post-metadata">

**Author:** ![Ilias](https://avatars.discourse-cdn.com/v4/letter/i/3bc359/32.png) [@Ilias](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FIlias)%5C
**Post date:** [August 18, 2021, 2:10pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F11 "2021-08-18T14:10:38Z")

</div>

Any news on this by any chance?

---

<div class="post-metadata">

**Author:** ![philschmid](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/philschmid/32/38022_2.png) [@philschmid](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fphilschmid)%5C
**Post date:** [August 18, 2021, 2:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-works-but-multidatamodel-doesnt%2F8530%2F12 "2021-08-18T14:37:51Z")

</div>

Hey @Ilias,

The MultiDataModel was solved. The `model.tar.gz` used was wrong. You can take a look here.

> [@Error deploying BERT on SageMaker](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-deploying-bert-on-sagemaker%2F8401%2F12)%3A
>
> That worked! The MultiDataModel works now! When I zipped the first time, I included the folder with tar zcvf model.tar.gz counterargument\_hugging when I should’ve just included the folder contents. man_facepalming Thank you so much for your help. blush
