|
Download example_uses.md from jesse-tong/vietnamese_hate_speech_detection: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/spaces/jesse-tong/vietnamese_hate_speech_detection/resolve/b8df0fa197530b05d17e316259d33917dbc7e97a/example_uses.md
- Command line
-
hf download hf://spaces/jesse-tong/vietnamese_hate_speech_detection@b8df0fa197530b05d17e316259d33917dbc7e97a/example_uses.md
-
curl -L -o example_uses.md https://huggingface.co/spaces/jesse-tong/vietnamese_hate_speech_detection/resolve/b8df0fa197530b05d17e316259d33917dbc7e97a/example_uses.md
1.42 kB
Example uses:
- Train with BERT model (train.csv is ag_news dataset with 4 classes)
python ./train.py --bert_model bert-base-uncased --data_path train.csv --label_column "Class Index" --text_column "Description" --epochs 4 --num_classes 4
- Inference with BERT model (test_data.csv is test dataset with 4 classes like ag_news)
python ./inference_example.py --bert_model bert-base-uncased --model_path "./bert_base_uncased/best_model.pth" --num_classes 4 --class_names "World" "Sports" "Business" "Science" --text_column "Description" --label_column "Class Index" --data_path "./test_data.csv" --inference_batch_limit 10
- Train LSTM model from BERT model using distillation (train dataset should be the same as distillation training dataset)
python ./distill_bert_to_lstm.py --bert_model bert-base-uncased --bert_model_path "./bert_base_uncased/best_model.pth" --output_dir "./docbert_lstm" --batch_size 32 --epochs 10 --data_path "./train.csv" --text_column "Description" --label_column "Class Index" --num_classes 4
- Inference with distilled LSTM model (test_data.csv is test dataset with 4 classes like ag_news)
python ./inference_lstm.py --model_path "./docbert_lstm/distilled_lstm_model.pth" --num_classes 4 --class_names "World" "Sports" "Business" "Science" --text_column "Description" --label_column "Class Index" --data_path "./test_data.csv" --inference_batch_limit 10