An exploration into training a BERT model for sentiment classification using Metal Performance Shaders.
You can skip this part if you are not interested in doing this experiment for yourself, but are interested in the results.
Must install miniforge3 so that we can train models using Mac ARM architecture:
Install the latest for OS X arm64
Next, run:
conda create --name myenv python=3.11
conda activate myenv
Make sure the conda environment is active before running any code in this project.
Then to install our needed packages from ๐ค
pip install transformers accelerate datasets
Install pytorch nightly to allow Metal Performance Shaders usage:
conda install pytorch-nightly::pytorch torchvision torchaudio -c pytorch-nightly
If you would like to run the model for yourself, run the following:
python training.py
Play around with the training parameters and see what happens.
playground.py
allows you to mess around with trained models. To play around with your own models, please update PATH_TO_MODEL
with the path to your trained model and TEXTS
with strings to classify.