Welcome to WangChanXNER! This repository contains a basic implementation for sequence labeling tasks. It provides functionalities for training and testing.
To install the necessary dependencies, run the following: python=3.8.16
seqeval
pythainlp
tabulate
pandas==2.0.3
torch==2.0.1
numpy==1.23.5
python=3.8.16
protobuf==3.20.0
transformers==4.29.2
Test the model with Colab.
You can download the checkpoint from our google drive: checkpoint.
Once downloaded, extract the files to ensure the appropriate directory structure.
unzip downloaded_checkpoint.zip -d storage/
.
├── utils
├── model
├── storage
├── trainer
├── inference.ipynb
└── inference.py
Run the main.py
script to train the model:
python main.py --device 0 -c storage/config_base.json
- The
--device
flag specifies the GPU device to use during training. In this example, GPU 0 will be used. - The
-c
flag points to the configuration fileconfig_lst20.json
, which holds the hyperparameters and settings for training.
xlm-roberta-base
airesearch/wangchanberta-base-att-spm-uncased
To test the model, use the inference.py
script:
python inference.py --resume storage/best_model/model_best.pth
- The
--resume
flag points to the saved checkpoint file to load the model for testing.
This project is inspired by Tensorflow-Project-Template created by Mahmoud Gemy. We express our gratitude to Mahmoud Gemy for providing the foundation and ideas for this project.