-
power_monitor_analysis/ExtractReading - get reading from power monitor for a time interval. The power monitor writes data in a database every 3 seconds.
-
Fine-tuningAnalysis - extracts data from nvidia-smi, power monitor and combine for analysis. Time-based models are compared to empirical values from power monitor. Carbon footprint is calculated. Also plotted the dataset size relationship with energy and time
-
RunInference - run inference on MRPC, CoLA and STS-B models fine-tuned earlier.
-
InferenceAnalysis - extracts data from nvidia-smi and power monitor for inference and combine for analysis. Time-based models are compared to empirical values from power monitor. Overall carbon footprint is calculated and combined with pre-training and fine-tuning.
-
CompareTimeModels - compare the time-based models.
Merges all data from pre-training, fine-tuning and inference to test scaling with time for models compared to analytical models -
nvidia-smi data exploration - extract data from nvidia-smi for fine-tuning tasks and initial exploration.
-
Time series data stationary test - data exploration and test with ADF
Requirements:
- Python 3.6+
- TensorFlow 2.2.0
- Pytorch 1.5.0
- Cuda 10.2
-
download miniconda and set the paths
-
conda update conda
conda create -n venv python=3.7
conda install -n venv jupyter scipy numpy matplotlib tensorflow-gpu tensorflow-hub seaborn
-
conda activate venv
Version issues :(
converted tf1 code to tf2 with tf_upgrade_v2.
tensorflow/tensorflow#26854
Steps:
- Download model
sh download_uncased_base.sh
- Get wiki data from https://github.com/pytorch/examples/tree/master/word_language_model/data
- Preprocess data
sh pretrain_data.sh
- Run training
sh pre_train.sh
OR
train and record power data
sh pretrain_and_record_power.sh
google-research/bert#341
https://github.com/dsindex/bert
-
Download wiki dump
-
Extract using https://github.com/attardi/wikiextractor
python ../wikiextractor/WikiExtractor.py /media/data/wikidownload.xml.bz2 --output /media/data/wikidump --processes 1 -q
-
Clean using
bash create_pretraining_data.sh
May need to install and import nltk
pip install nltk
import nltk
nltk.download('punkt')
-
Run pretraining
sh pretrain_large.sh
Runs fine-tune training and record power draw and utilisation with nvidia-smi
sh train_and_record_power.sh task batchsize maxSeqLength model(cased/uncased)
sh train_and_record_power.sh CoLA 32 128 bert-base-cased
-
Get model - download from https://github.com/google-research/bert
-
Get data using
download_glue_data.py
python download_glue_data.py --data_dir data --tasks MRPC
-
Prepare fine tune data using
sudo sh fine_tune.sh
(edit fields) -
Run
python bert_finetune.py
https://github.com/tensorflow/models/tree/master/official/nlp/bert
https://github.com/tensorflow/models/tree/master/official/nlp/bert#process-datasets
For pytorch implementation
-
pip install statsmodels
-
git clone https://github.com/huggingface/transformers
cd transformers
pip install .
-
pip install -r ./examples/requirements.txt
(
git pull
pip install --upgrade .
) -
download data as in tensorflow example. No need to download model separately
-
cd ..
-
sh fine_tune_example.sh MRPC 32
Task argument can be CoLA, SST-2, MRPC, STS-B, QQP, MNLI, QNLI, RTE, WNLI
Second argument, batch size can 16, 32, 64, etc -
Record gpu utilization details
sh nvidiasmi.sh
Download wikitext2 from https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/
sh mlm_fine_tune_bert.sh
More in /modelsFT