TEXTOIR icon indicating copy to clipboard operation
TEXTOIR copied to clipboard

Running inference on a trained model

Open abal6725 opened this issue 2 years ago • 3 comments

Hello,

First of thank you so much for developing and open-sourcing this. I have used DeepAligned on the Banking dataset to train and save a model. Now I would like to use this model to run inference on another set of data. How can I do this? Thanks!

abal6725 avatar Jun 23 '22 19:06 abal6725

First, the data need to be in the same format as in Banking. Second, you can just load the pre-trained model for inference (It should predict intent labels for each utterance). If you encounter any problems during inference, please notify us and we will fix the bugs.

HanleiZhang avatar Jun 24 '22 01:06 HanleiZhang

Hi,

I have used the following command to train a model on the banking dataset:

!python TEXTOIR/open_intent_discovery/run.py --dataset banking --method 'DeepAligned' --setting 'semi_supervised' --known_cls_ratio 0.75 --seed 1 --backbone 'bert' --config_file_name 'DeepAligned' --train --save_model --save_results --results_file_name 'results_DeepAligned.csv' --output_dir output

My model is saved in the following directory:

image

I would now like to use this model to run inference on a sample of data that does not exist in the banking77 dataset and see what labels this model predicts. How can I set this up? Should I create a new folder within the data folder and set my data in a test.tsv? Also what is the exact command that I need to run so that it picks up this trained model and point it to my new data?

Thanks in advance for the help!

abal6725 avatar Jun 30 '22 19:06 abal6725

The first thing you need to do is create a new directory in your data file, which is structured like banking. Then configure your data set information in /dataloaders/init.py. Then you can configure the trained model directory with '--model_output_dir' and set '-- train 'to False. To load the trained model and specify the dataset you want to predict with the 'dataset' parameter, perform label prediction.

mrFocusXin avatar Aug 02 '22 01:08 mrFocusXin