# Pipeline cannot infer suitable model classes

**URL:** <https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339>\
**Category:** 🤗Hub\
**Created:** [November 3, 2021, 11:55pm UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339 "2021-11-03T23:55:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajaram1996](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rajaram1996/32/3025_2.png) [@Rajaram1996](https://discuss.huggingface.co/u/Rajaram1996)\
**Post date:** [November 3, 2021, 11:55pm UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/1 "2021-11-03T23:55:37Z")

</div>

When I try to use the inference pipeline widget for my private project, I got this error.

 ![Screenshot_20211103-195337_Chrome](https://us1.discourse-cdn.com/hellohellohello/original/2X/7/75680f29454413ed800cb18714aeed0320c376d7.jpeg)

But the prediction is working when I do locally (gives back proper labels)

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](https://discuss.huggingface.co/u/nielsr)\
**Post date:** [November 5, 2021, 9:51am UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/2 "2021-11-05T09:51:41Z")

</div>

Pinging @Narsil

---

<div class="post-metadata">

**Author:** ![NarsilTest](https://avatars.discourse-cdn.com/v4/letter/n/e480ec/32.png) [@NarsilTest](https://discuss.huggingface.co/u/NarsilTest)\
**Post date:** [November 5, 2021, 12:29pm UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/3 "2021-11-05T12:29:52Z")

</div>

Seems to be working now, did you fix anything particular ?

Edit: Looked at the wrong repo I guess.

---

<div class="post-metadata">

**Author:** ![Rajaram1996](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rajaram1996/32/3025_2.png) [@Rajaram1996](https://discuss.huggingface.co/u/Rajaram1996)\
**Post date:** [November 5, 2021, 3:59pm UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/4 "2021-11-05T15:59:25Z")

</div>

Hi. Yes, it is working now. Thanks for that. But now, it is only displaying 5 of the classification labels (for context, there are 14 labels). The labels are not shown as top 5 predictions, but the first 5 labels defined in config.json. Is there a way in the pipeline to define a number of classification labels as percentages from highest to lowest? [Reference](https://huggingface.co/transformers/main_classes/pipelines.html#transformers.AudioClassificationPipeline. __call__ )  
Can we manually override top\_k value from README.md?

---

<div class="post-metadata">

**Author:** ![Narsil](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/narsil/32/40029_2.png) [@Narsil](https://discuss.huggingface.co/u/Narsil)\
**Post date:** [November 11, 2021, 9:39am UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/5 "2021-11-11T09:39:52Z")

</div>

Hi @Rajaram1996

The predictions should always show the 5 top scores, can you provide a link to the wrong behavior ?

Cheers,

---

<div class="post-metadata">

**Author:** ![Rajaram1996](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rajaram1996/32/3025_2.png) [@Rajaram1996](https://discuss.huggingface.co/u/Rajaram1996)\
**Post date:** [November 11, 2021, 4:18pm UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/6 "2021-11-11T16:18:03Z")

</div>

When I use the hosted inference widget, I am only getting the confidence score of 5 random emotions which are not the top\_5 values. I am adding image for reference.

 ![Screen Shot 2021-11-11 at 11.08.35 AM](https://us1.discourse-cdn.com/hellohellohello/original/2X/7/7216aa70c273a427f1fdc5edde404342266010f3.png)

When I predict with the model on my local inference, I get “female\_happy 0.98” or 98% (image attached below) which is supposed to be the correct prediction (in total there are 14 classes to predict from).

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

---

<div class="post-metadata">

**Author:** ![Narsil](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/narsil/32/40029_2.png) [@Narsil](https://discuss.huggingface.co/u/Narsil)\
**Post date:** [November 12, 2021, 11:24am UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/7 "2021-11-12T11:24:49Z")

</div>

The API is powered by the pipelines, it seems you’re trying a private model so I don’t really have access, but you can check out

`pipe = pipeline(model="NR/myprivate_model")`  
`pipe("myfilename.wav")`

It should work out of the box and produce the same thing as the API.

---

<div class="post-metadata">

**Author:** ![Rajaram1996](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rajaram1996/32/3025_2.png) [@Rajaram1996](https://discuss.huggingface.co/u/Rajaram1996)\
**Post date:** [November 12, 2021, 3:18pm UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/8 "2021-11-12T15:18:12Z")

</div>

Hey. Thanks for working through this. You can check the model [here](https://huggingface.co/Rajaram1996/Hubert_emotion). Even that pipeline snippet, which I tried in my colab notebook gave me this:  
`[{'label': 'male_disgust', 'score': 0.07790017127990723}, {'label': 'female_sad', 'score': 0.07736612856388092}, {'label': 'female_neutral', 'score': 0.07557496428489685}, {'label': 'female_angry', 'score': 0.07553239166736603}, {'label': 'female_disgust', 'score': 0.07268150895833969}]`  
Let me know if you need more info.

---

<div class="post-metadata">

**Author:** ![vblagoje](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/vblagoje/32/20818_2.png) [@vblagoje](https://discuss.huggingface.co/u/vblagoje)\
**Post date:** [November 13, 2021, 3:18pm UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/9 "2021-11-13T15:18:11Z")

</div>

@Narsil the model I want to use is public but doesn’t have an appropriate pipeline. ~~What are my options for using it in inferencing?~~ Figured it out.

---

<div class="post-metadata">

**Author:** ![Narsil](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/narsil/32/40029_2.png) [@Narsil](https://discuss.huggingface.co/u/Narsil)\
**Post date:** [November 15, 2021, 10:39am UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/10 "2021-11-15T10:39:02Z")

</div>

@Rajaram1996 ,

I just checked your model, and it seems it’s using

> `'classifier.dense.bias', 'classifier.out_proj.weight', 'classifier.out_proj.bias', 'classifier.dense.weight'`

instead of

> `'classifier.bias', 'classifier.weight', 'projector.weight', 'projector.bias'`

when loading (check the warings), which leads to random outputs no matter the input.  
Try renaming the tensors appropriately for it to work.

So most likely, the pipeline is not broken but it just seems like the weights are incorrect so the head gives garbage output.

---

<div class="post-metadata">

**Author:** ![Rajaram1996](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rajaram1996/32/3025_2.png) [@Rajaram1996](https://discuss.huggingface.co/u/Rajaram1996)\
**Post date:** [November 15, 2021, 2:54pm UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/11 "2021-11-15T14:54:44Z")

</div>

Thank you for that information. I will check it out.

---

<div class="post-metadata">

**Author:** ![KELONMYOSA](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/kelonmyosa/32/16416_2.png) [@KELONMYOSA](https://discuss.huggingface.co/u/KELONMYOSA)\
**Post date:** [May 29, 2023, 10:30am UTC](https://discuss.huggingface.co/t/pipeline-cannot-infer-suitable-model-classes/11339/12 "2023-05-29T10:30:30Z")

</div>

I’m facing the same problem. Could someone help please.

> **[KELONMYOSA/wav2vec2-xls-r-300m-emotion-ru · Hugging Face](https://huggingface.co/KELONMYOSA/wav2vec2-xls-r-300m-emotion-ru)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/c/8/c8ba6d7296ba67f7a702608d02fed35c5bc7b587.png)  
But the pipeline works locally
