WudaoSailing is a package for pretraining chinese Language Model and finetune tasks. Now it supports GLM, Bert, T5, Cogview and Roberta models.
Get Started
Docker Image
We prepare two docker images based on CUDA 10.2 and CUDA 11.2. You can build images from the docker file docs/docker/cuda102.dockerfile or pull the pre-built images from Docker Hub and run with docker v19.03+
We provide scripts for finetuning GLM on some downstream tasks.
SuperGLUE
Download the SuperGlue data and check the experiment setup in
examples/glm/scripts/ds_finetune_superglue.sh. Note that DATA_ROOT, CHECKPOINT_PATH, SAVE_PATH
need to be changed to your local path. You may also change the batch-size and nproc_per_node according to your
available hardware.
Run the following script for text similarity finetune task (use the afqmc dataset as an example)
cd examples/glm/
bash scripts/ds_finetune_superglue.sh\
config/model_blocklm_large_chinese.sh\
config_tasks/task_afqmc.sh
Run the following script for text classification finetune task (use the thunews and thunews dataset as an example)
cd examples/glm/
bash scripts/ds_finetune_superglue.sh\
config/model_blocklm_large_chinese.sh\
config_tasks/task_tnews.sh
Run the following script for causal inference finetune task (use the COPA dataset as an example)
cd examples/glm/
bash scripts/ds_finetune_superglue.sh\
config/model_blocklm_large_chinese.sh\
config_tasks/task_copa.sh
The script examples/glm/config/ds_pretrain_nvidia.sh launches the training program with DeepSpeed. You should change NUM_WORKERS and NUM_GPUS_PER_WORKER to the number of workers and the number of gpus per worker. Also change HOST_FILE_PATH to the path to an OpenMPI-style hostfile. More details about DeepSpeed launcher can be found here.
The file examples/glm/config/ds_block_large.sh defines the hyperparameters for pretraining. Most of the arguments are fairly self-explanatory. Specifically, --train-data can be multiple keywords defined in NAMED_CORPORA in data_utils/corpora.py. The hyperparameters of the optimizer are defined in the corresponding json file under config. The semantics of the json file can be found here.
Bert
We show some examples based on GLM model.
Pretrain
Run the following script to pre-train the Bert model
shell
1cd examples/bert/
2python quick_start.py
CogView
Pretrain
Run the following script to pre-train the cogview model