# Problem with pipeline on custom model

**URL:** <https://discuss.huggingface.co/t/problem-with-pipeline-on-custom-model/21170>\
**Category:** Beginners\
**Created:** [August 2, 2022, 8:01pm UTC](https://discuss.huggingface.co/t/problem-with-pipeline-on-custom-model/21170 "2022-08-02T20:01:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![okite97](https://avatars.discourse-cdn.com/v4/letter/o/76d3ee/32.png) [@okite97](https://discuss.huggingface.co/u/okite97)\
**Post date:** [August 2, 2022, 8:01pm UTC](https://discuss.huggingface.co/t/problem-with-pipeline-on-custom-model/21170/1 "2022-08-02T20:01:00Z")

</div>

I built a custom transformer for a SequenceClassification task. Everything works fine but when I want to load my model using pipeline, I get wrong results.

```auto
model_ckpt = 'roberta-base'
tokenizer = AutoTokenizer.from_pretrained(model_ckpt)

labels =['health','business', 'politics', 'entertainment', 'sports', 'tech']
index2cat = {idx:cat for idx, cat in enumerate(labels)}
cat2index = {cat: idx for idx, cat in enumerate(labels)}

```

### Here is my custom SequenceClassification model

 ![def_](https://us1.discourse-cdn.com/hellohellohello/original/2X/2/295aa498f61b599867548ddc46fe8d7ed51ff995.jpeg)

### Trainer and training args

 ![train_](https://us1.discourse-cdn.com/hellohellohello/original/2X/e/ecb00776f46f82d52372a6861ac236d375c7c8dc.jpeg)

### Using pipeline

Calling pipeline with the task, model and tokenizer gives the correct results but with the model ID on hub or local directory, I get wrong results. See sample below

 ![pipe_](https://us1.discourse-cdn.com/hellohellohello/original/2X/3/31002cb82c5f48c796281bce326ab1a43256dd8a.jpeg)

I have been on this for few days now and still cannot have a breakthrough at solving it. Thank you
