How to use pipeline custom code/make new pipeline?

Hi, I read all the topics and post related to the questions that I am asking but I can’t seem to find anyone using the code that this Pipelines and this How to add a pipeline to 🤗 Transformers? link used. I do not really understand how I am supposed to use the code but I need to customise the pipeline to fit my intent classification data. I’m not sure which code I’m supposed to be using so I tried both code from the link.

For this code, what am I supposed to change TextClassificationPipeline to? Or am I supposed to import something?

For this code, what am I supposed to put in Tensor(). The documentation said to put a desired input like dictionary so I tried putting a dictionary which allowed the class to run. I added this tokenized data into the Tensor()

however, the output was not what I wanted.

so I tried calling the pipeline by adding another code as I have seen in the pipeline documentation. but I got an error saying Tensor is not defined. I tried importing Tensor but it says no module named Tensor even though I already pip install Tensor

In the documentation, it showed that there was a new pipeline made and I was so confused how the person was able to make a new pipeline called my-new-task. I really need help regarding this and I’m sorry this post is quite all over the place because I’m not sure what I’m supposed to be trying to make my code work. The expected output I want would be something like the documentation using my-new-task pipeline and being able to predict the score of the label predicted. As I am doing intent classification and not text classification, the pipeline for textclassification does not suit me as I need the prediction to be my data’s label.

This is an example of my dataset.

image

My purpose for using pipeline is to get the score for the predicted output because I need a scoring system like confidence score to get the fallback intent.

Really hope someone can help because this is for school project and the deadline is near ><