# Get logits from Inference API Classification Model (for Regression)

**URL:** <https://discuss.huggingface.co/t/get-logits-from-inference-api-classification-model-for-regression/23511>\
**Category:** 🤗Hub\
**Created:** [September 22, 2022, 9:28pm UTC](https://discuss.huggingface.co/t/get-logits-from-inference-api-classification-model-for-regression/23511 "2022-09-22T21:28:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pfr](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@pfr](https://discuss.huggingface.co/u/pfr)\
**Post date:** [September 22, 2022, 9:28pm UTC](https://discuss.huggingface.co/t/get-logits-from-inference-api-classification-model-for-regression/23511/1 "2022-09-22T21:28:58Z")

</div>

I have a [RobertaForSequenceClassification](https://huggingface.co/docs/transformers/model_doc/roberta#transformers.RobertaForSequenceClassification) model fine-tuned for a regression task on the model hub. The inference api currently outputs the sigmoid of the model outputs, as for classification tasks. However, the model is trained for regression, so I actually need the logits themselves.

Is there any way I can configure the inference api to output the logits?

Thank you!

---

<div class="post-metadata">

**Author:** ![pfr](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@pfr](https://discuss.huggingface.co/u/pfr)\
**Post date:** [September 23, 2022, 4:05am UTC](https://discuss.huggingface.co/t/get-logits-from-inference-api-classification-model-for-regression/23511/2 "2022-09-23T04:05:30Z")

</div>

I was able to solve this by adding the following to the `README.md`:

```auto
---
inference:
  parameters:
    function_to_apply: "none"
---

```

Some relevant sources:

- [how-can-i-control-my-models-widget-inference-api-parameters](https://huggingface.co/docs/hub/models-widgets#how-can-i-control-my-models-widget-inference-api-parameters)
- [Return raw outputs in TextClassificationPipeline](https://github.com/huggingface/transformers/pull/8328)

---

<div class="post-metadata">

**Author:** ![adenhaus](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/adenhaus/32/19720_2.png) [@adenhaus](https://discuss.huggingface.co/u/adenhaus)\
**Post date:** [January 24, 2024, 9:46am UTC](https://discuss.huggingface.co/t/get-logits-from-inference-api-classification-model-for-regression/23511/3 "2024-01-24T09:46:16Z")

</div>

Hi @pfr

I also want to do inference with a regression model I fine-tuned. Could you please show me how to extract the probability from the logits?

Thanks
