This repository contains code and resources for building an Intent Detection model using the XLM-Roberta architecture. Intent detection is a common task in Natural Language Processing (NLP), where the goal is to determine the intent or purpose behind a user's input.
In this project, we leverage the power of the Hugging Face Transformers library to fine-tune an XLM-Roberta model for intent detection tasks. The model can be used for various applications, including chatbots, virtual assistants, and customer support systems.
- Preprocessing scripts for data preparation.
- Fine-tuning scripts for training the XLM-Roberta model on your dataset.
- Inference code for predicting intents using the trained model.
- Example notebooks and usage instructions.
Before getting started, ensure you have the following prerequisites:
- Python 3.x
- PyTorch
- Hugging Face Transformers library
- Other dependencies as specified in
requirements.txt
-
Clone this repository to your local machine:
git clone https://github.com/MLArtist/intent-detection-using-XLM-Roberta.git cd intent-detection-using-XLM-Roberta
-
Install the required dependencies:
pip install -r requirements.txt
To perform inference on your local machine without using Docker, follow these steps:
-
Download the fine-tuned model weights from the Google Drive.
-
Place the downloaded files in the 'xlm-roberta-large-custom-trained' folder.
-
Once you have completed these steps, run the inference server:
python -m server --model xlm-roberta-large-custom-trained
-
Test the inference server
curl http://localhost:8080/ready curl -X POST -H "Content-Type: application/json" -d '{"text": "when is the next flight to new york"}' http://localhost:8080/intent
To perform inference using Docker, follow these steps:
-
Download the fine-tuned model weights from the Google Drive.
-
Place the downloaded files in the 'xlm-roberta-large-custom-trained' folder.
-
Build the Docker image:
docker build -t my-roberta-app -f Dockerfile .
-
Run the Docker container, mapping port 8080 (or your preferred port) and specifying the model:
docker-compose -f docker-compose.yml up
-
test the inference server
curl http://localhost:8080/ready curl -X POST -H "Content-Type: application/json" -d '{"text": "when is the next flight to new york"}' http://localhost:8080/intent
Use the example notebook Train.ipynb
in the notebooks/
directory for detailed training and offline model evaluation.
For any inquiries or issues, please open an issue.