git clone https://github.com/wooooooooook/imdb-sentiment-classifier.git imdb_model
cd imdb_model
git lfs pullgit-lfs needed
conda create -n imdb_py310 python=3.10 -y
conda activate imdb_py310
pip install torchtext==0.17.0 --force-reinstall \
transformers==4.38.2 \
accelerate==0.27.2 \
torch \
pandas \
tqdm
python3 model.py <INPUT_DATA_PATH> model_weightwget https://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz
tar -xzf aclImdb_v1.tar.gz- Use the
Twitter‑RoBERTatokenizer - Set maximum input token length to
512 - Configure batch size to
64 - Freeze nine layers of the
Twitter‑RoBERTamodel and fine‑tune the remaining three layers - Employ
GradScalerwithautocastfor 16‑bit floating‑point precision - Learning rates:
- RoBERTa layers:
2 × 10⁻⁵ - Fully connected layer:
1 × 10⁻⁴ - Apply a weight decay of
0.01 - Save model weights each time a new best metric is achieved
- Training performed on a single
NVIDIA GeForce RTX 3090GPU, taking approximately 20 minutes