YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Joint Intent and Entity Recognition Model
This repository contains a joint model for intent classification and entity recognition using the Hugging Face Transformers library. The model is trained on a custom dataset and can be used for various natural language understanding tasks.
Dataset
The dataset is stored in data/train.json and consists of examples with the following structure:
{
"text": "Set a reminder to buy groceries tomorrow",
"intent": "set_reminder",
"entities": [
{"word": "call mom", "label": "action"},
{"word": "mom", "label": "person"},
{"word": "5 PM", "label": "time"}
]
}
Training
To train the model, run the train.py script. This script will preprocess the data, build the label maps for intents and entities, and save them as JSON files in the jsons directory.
python train.py
Model Architecture
The model uses a pre-trained transformer (e.g., BERT) as the base and adds separate heads for intent classification and entity recognition. The intent classification head is a simple feedforward layer, while the entity recognition head uses a token-level classification approach.
Evaluation
After training, you can evaluate the model on a test set (not included in this repository) to measure its performance on both intent classification and entity recognition tasks.
Future Work
- Implement a more sophisticated model architecture, such as using a CRF layer for entity recognition.
- Explore the use of attention mechanisms to improve the model's ability to focus on relevant parts of the input text.
- Expand the dataset with more examples and a wider variety of intents and entities.
Conclusion
This project demonstrates how to build a joint model for intent classification and entity recognition using the Hugging Face Transformers library. By training on a custom dataset, the model can effectively understand user queries and extract relevant information for various applications.
- I have uploaded everything in the repo including json files and the trained model.
- Downloads last month
- 1