# Missing likelihood for all the classes in inference after BERT model deployed in SageMaker

**URL:** <https://discuss.huggingface.co/t/missing-likelihood-for-all-the-classes-in-inference-after-bert-model-deployed-in-sagemaker/12110>\
**Category:** Beginners\
**Created:** [November 20, 2021, 11:03pm UTC](https://discuss.huggingface.co/t/missing-likelihood-for-all-the-classes-in-inference-after-bert-model-deployed-in-sagemaker/12110 "2021-11-20T23:03:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cfloressuazo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cfloressuazo/32/3240_2.png) [@cfloressuazo](https://discuss.huggingface.co/u/cfloressuazo)\
**Post date:** [November 20, 2021, 11:03pm UTC](https://discuss.huggingface.co/t/missing-likelihood-for-all-the-classes-in-inference-after-bert-model-deployed-in-sagemaker/12110/1 "2021-11-20T23:03:54Z")

</div>

Hi,

I have recently deployed the FinBERT model in SageMaker, and I am using it for inference in a text classification task. When I call the `predictor.predict(data)` I get only the label and probability of the predicted one (the one with the maximum value), but I am missing the ones for the other classes. I have already tried passing the input data to the `predict` method with the `inputs` and `parameters` but this doesn’t change anything. How can I retrieve all the labels and their probs when doing the inference on a Hugginface model in SageMaker?

I’m also posting the full code here if this helps in any way:

## Model Deployment

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

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
    'HF_MODEL_ID':'ProsusAI/finbert',
    'HF_TASK':'text-classification'
}

# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
    transformers_version='4.6.1',
    pytorch_version='1.7.1',
    py_version='py36',
    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
)

```

## Get Predictor

```auto
predictor = sagemaker.predictor.Predictor(
    endpoint_name = 'huggingface-pytorch-inference-endpoint',
    sagemaker_session = sess,
    serializer = sagemaker.serializers.JSONSerializer()
    
)

```

## Inference

```auto
import json

data = {
    'inputs': ['LYXe partnering with Fan Zone a recent investment and partner of Porsche is a true signal of a continued growth in its e'], 
    'parameters': {
        'candidate_labels': [
            'negative', 
            'positive', 
            'neutral'
        ]
    }
}
print(json.loads(predictor.predict(data)))

```

## Result

```auto
[{'label': 'positive', 'score': 0.9388243556022644}]

```

What I am expecting is something like `[{'label': 'negative', 'score': ....}, {'label': 'neutral', 'score': ....}, {'label': 'positive', 'score': ....}]`

Thank you!

---

<div class="post-metadata">

**Author:** ![dineshmane](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@dineshmane](https://discuss.huggingface.co/u/dineshmane)\
**Post date:** [June 15, 2022, 1:06pm UTC](https://discuss.huggingface.co/t/missing-likelihood-for-all-the-classes-in-inference-after-bert-model-deployed-in-sagemaker/12110/2 "2022-06-15T13:06:46Z")

</div>

Did you find the solution?
