TakoiHirokazu/kaggle_commonLit_readability_prize

the 2nd place solution code of Kaggle CommonLit Readability Prize

Python

34

32 commits

updated Aug 16, 2021

See the code

README

Kaggle CommonLit Readability Prize 2nd place solution

This is repository of the 2nd place solution of Kaggle CommonLit Readability Prize.
The discription of this solution is available here.
The prediction notebook in the competition is available here.
A partially revised prediction notebook is here.

Hardware

I used three different machines.

  1. Google Cloud Platform
  • Debian 10.10
  • n1-highmem-8 (vCPU x 8, memory 52 GB)
  • 1 x NVIDIA Tesla V100
  1. Google Cloud Platform
  • Ubuntu 18.04
  • a2-highgpu-1g (vCPU x 12, memory 85 GB)
  • 1 x NVIDIA Tesla A100
  1. kaggle notebook

Environment(except for kaggle notebook)

$ docker-compose up --build -d
$ docker exec -it commonlit bash

Data download

Plese download data to ./data from https://www.kaggle.com/c/commonlitreadabilityprize/data and unzip it.

Model download

I used several pretrained models that are publicly available in the kaggle dataset. Please download it to the following directories and unzip it.

Prerocess

Plese download data to ./data from https://www.kaggle.com/takoihiraokazu/commonlit-fold and unzip it. This is the data for cross validation, and is the result of re-running here.

Train

$ sh bin/train.sh

Please note that the results of ex131.py(deberta-v2-xlarge), ex194.py(deberta-v2-xlarge), ex216.py(deberta-v2-xxlarge) and ex407.py(funnel-transformer-large) will change with each train. Also, I did not fix the seed in mlm_roberta_base.py during the competition period, so if you want to reproduce ex237.py, please use this pretrained model instead of output of mlm_roberta_base.py. I have also listed below the hardware numbers where I performed each training during the competition.

expHardware
ex014.py3
ex015.py3
ex064.py1
ex072.py1
ex084.py1
ex094.py1
ex107.py1
ex131.py2
ex182.py2
ex190.py2
ex194.py2
ex216.py2
mlm_roberta_base.py3
ex237.py3
ex272.py2
ex292.py2
ex384.py2
ex407.py2
ex429.py2
ex434.py2
ex448.py2
ex450.py2
ex465.py2
ex497.py2
ex507.py2

Ensemble & Post process

$ sh bin/ensemble_postprocess.sh

The ensemble weights were adjusted based on the output of ensemble.py and by looking at the Public Score. The PostProcess coefficients and thresholds were also adjusted based on the output of postprocess.py and by looking at the Public Score. The final weights, coefficientsare and thresholds as follows. The public and private scores for each model are also listed.

ensebmle

expmodelPublicPrivateweight
ex015roberta base -> svr0.4760.4780.020
ex015roberta base -> ridge0.4750.4760.020
ex072roberta large0.4630.4660.088
ex107bart large0.4690.4710.090
ex182deberta large0.4600.4630.230
ex190electra large0.4700.4710.050
ex194deberta v2 xlarge0.4660.4670.050
ex216deberta v2 xxlarge0.4650.4660.140
ex237roberta base(with mlm)0.4760.4730.040
ex272funnel large base0.4710.4730.050
ex292mpnet base0.4700.4730.130
ex384muppet roberta large0.4660.4680.022
ex407funnel large0.4640.4710.110
ex429gpt2 medium0.4780.4820.170
ex434t5 large0.4980.494-0.110
ex448 + ex450albert xxlarge v20.4670.4710.120
ex465electra base0.4820.483-0.170
ex497bert base uncased0.5060.497-0.140
ex507distilbart cnn 12 60.4790.4770.090

post process

  • Predictions >= 0.3 -> Predictions * 1.07
  • 0.3 > Predictions >= 0 -> Predictions * 1.2
  • 0 > Predictions >= -0.7 -> Predictions * 0.97485814
  • -0.7 > Predictions >= -0.9 -> Predictions * 1.01
  • -0.9 > Predictions >= -2.0 -> Predictions * 1.02150304
  • -2.0 > Predictions -> Predictions * 1.02764047

Predict

$ sh bin/predict.sh

TakoiHirokazu/kaggle_commonLit_readability_prize

the 2nd place solution code of Kaggle CommonLit Readability Prize

Python

34

32 commits

updated Aug 16, 2021

See the code

README

Kaggle CommonLit Readability Prize 2nd place solution

This is repository of the 2nd place solution of Kaggle CommonLit Readability Prize.
The discription of this solution is available here.
The prediction notebook in the competition is available here.
A partially revised prediction notebook is here.

Hardware

I used three different machines.

  1. Google Cloud Platform
  • Debian 10.10
  • n1-highmem-8 (vCPU x 8, memory 52 GB)
  • 1 x NVIDIA Tesla V100
  1. Google Cloud Platform
  • Ubuntu 18.04
  • a2-highgpu-1g (vCPU x 12, memory 85 GB)
  • 1 x NVIDIA Tesla A100
  1. kaggle notebook

Environment(except for kaggle notebook)

$ docker-compose up --build -d
$ docker exec -it commonlit bash

Data download

Plese download data to ./data from https://www.kaggle.com/c/commonlitreadabilityprize/data and unzip it.

Model download

I used several pretrained models that are publicly available in the kaggle dataset. Please download it to the following directories and unzip it.

Prerocess

Plese download data to ./data from https://www.kaggle.com/takoihiraokazu/commonlit-fold and unzip it. This is the data for cross validation, and is the result of re-running here.

Train

$ sh bin/train.sh

Please note that the results of ex131.py(deberta-v2-xlarge), ex194.py(deberta-v2-xlarge), ex216.py(deberta-v2-xxlarge) and ex407.py(funnel-transformer-large) will change with each train. Also, I did not fix the seed in mlm_roberta_base.py during the competition period, so if you want to reproduce ex237.py, please use this pretrained model instead of output of mlm_roberta_base.py. I have also listed below the hardware numbers where I performed each training during the competition.

expHardware
ex014.py3
ex015.py3
ex064.py1
ex072.py1
ex084.py1
ex094.py1
ex107.py1
ex131.py2
ex182.py2
ex190.py2
ex194.py2
ex216.py2
mlm_roberta_base.py3
ex237.py3
ex272.py2
ex292.py2
ex384.py2
ex407.py2
ex429.py2
ex434.py2
ex448.py2
ex450.py2
ex465.py2
ex497.py2
ex507.py2

Ensemble & Post process

$ sh bin/ensemble_postprocess.sh

The ensemble weights were adjusted based on the output of ensemble.py and by looking at the Public Score. The PostProcess coefficients and thresholds were also adjusted based on the output of postprocess.py and by looking at the Public Score. The final weights, coefficientsare and thresholds as follows. The public and private scores for each model are also listed.

ensebmle

expmodelPublicPrivateweight
ex015roberta base -> svr0.4760.4780.020
ex015roberta base -> ridge0.4750.4760.020
ex072roberta large0.4630.4660.088
ex107bart large0.4690.4710.090
ex182deberta large0.4600.4630.230
ex190electra large0.4700.4710.050
ex194deberta v2 xlarge0.4660.4670.050
ex216deberta v2 xxlarge0.4650.4660.140
ex237roberta base(with mlm)0.4760.4730.040
ex272funnel large base0.4710.4730.050
ex292mpnet base0.4700.4730.130
ex384muppet roberta large0.4660.4680.022
ex407funnel large0.4640.4710.110
ex429gpt2 medium0.4780.4820.170
ex434t5 large0.4980.494-0.110
ex448 + ex450albert xxlarge v20.4670.4710.120
ex465electra base0.4820.483-0.170
ex497bert base uncased0.5060.497-0.140
ex507distilbart cnn 12 60.4790.4770.090

post process

  • Predictions >= 0.3 -> Predictions * 1.07
  • 0.3 > Predictions >= 0 -> Predictions * 1.2
  • 0 > Predictions >= -0.7 -> Predictions * 0.97485814
  • -0.7 > Predictions >= -0.9 -> Predictions * 1.01
  • -0.9 > Predictions >= -2.0 -> Predictions * 1.02150304
  • -2.0 > Predictions -> Predictions * 1.02764047

Predict

$ sh bin/predict.sh