LoginSignup
1
1

富岳のPyTorch-1.7.0でJGLUEのJCommonSenseQAを動かすには

Posted at

昨日の記事の続きだが、スーパーコンピュータ「富岳」のPyTorch-1.7.0上で、JGLUEを動かしてみることにした。

#! /bin/bash
#PJM -L rscgrp=small
#PJM -L elapse=4:00:00
#PJM -L node=1
#PJM -j
#PJM -S

G=`id | sed 's/^.*gid=[0-9]*(\([^)]*\)).*$/\1/'`
set `ls -d /vol*/$G /vol*/data/$G` $HOME
export PYTHONUSERBASE=$1/jglue
export PATH=/home/apps/oss/PyTorch-1.7.0/bin:$PYTHONUSERBASE/bin:$PATH
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/apps/oss/PyTorch-1.7.0/lib64
export HF_HOME=$PYTHONUSERBASE
export TMPDIR=$PYTHONUSERBASE/tmp
mkdir -p $TMPDIR
T=$TMPDIR/transformers-4.28.1
if [ ! -d $T ]
then git clone -b v4.28.1 --depth=1 https://github.com/huggingface/transformers $T
fi
J=$TMPDIR/JGLUE
if [ ! -d $J ]
then git clone --depth=1 https://github.com/yahoojapan/JGLUE $J
     cat $J/fine-tuning/patch/transformers-4.9.2_jglue-1.1.0.patch | ( cd $T && patch -p1 )
     pip3.8 install tokenizers==0.13.3 protobuf==3.20.3 accelerate==0.20.3 --user
     ( cd $T && pip3.8 install . --user )
     pip3.8 install -r $T/examples/pytorch/text-classification/requirements.txt --user
     pip3.8 install -U tqdm packaging typing_extensions --user
fi

python3.8 $T/examples/pytorch/multiple-choice/run_swag.py --model_name_or_path KoichiYasuoka/deberta-base-japanese-wikipedia --do_train --do_eval --do_predict --max_seq_length 64 --per_device_train_batch_size 16 --learning_rate 5e-05 --num_train_epochs 4 --output_dir $TMPDIR/output.${PJM_JOBID-$$} --overwrite_output_dir --train_file $J/datasets/jcommonsenseqa-v1.1/train-v1.1.json --validation_file $J/datasets/jcommonsenseqa-v1.1/valid-v1.1.json --test_file $J/datasets/jcommonsenseqa-v1.1/valid-v1.1.json --use_fast_tokenizer True --evaluation_strategy epoch --warmup_ratio 0.1

富岳のログインノードからpjsubして、deberta-base-japanese-wikipediaのJCommonSenseQAを測ってみたところ、ファインチューニングに3時間を要した後に、以下の「eval metrics」が出力された。

***** eval metrics *****
  epoch                   =        4.0
  eval_accuracy           =      0.639
  eval_loss               =     2.1449
  eval_runtime            = 0:01:54.73
  eval_samples            =       1119
  eval_samples_per_second =      9.752
  eval_steps_per_second   =       1.22

私(安岡孝一)の2022年6月25日の日記とほぼ同じ結果だが、ファインチューニングに9倍もの時間を要している。やっぱり、複数ノードに挑戦しなきゃダメかな。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1