Before starting you need to prepare the environment:
python -m venv venv && source venv/bin/activate
To install dependencies:
pip install -r requirements.txt
To train model with default parameters simply execute next command:
python -m trainer
To specify pretrained model from Hugging Face Hub use arguments:
python -m trainer --model_checkpoint distilbert/distilbert-base-cased
To show all available arguments and adjust training:
python -m trainer --help
To serve prediction endpoint simply execute next command:
python -m server --model_checkpoint distilbert/distilbert-base-cased
cURL request example:
curl -X "POST" "http://127.0.0.1:8000/score" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{"text": "Is this text easy to read?"}'