Downloads · 30 days
0
guoqiang/glm
glm is a machine learning model from guoqiang. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
WudaoSailing is a package for pretraining chinese Language Model and finetune tasks. Now it supports GLM, Bert, T5, Cogview and Roberta models.
Downloads · 30 days
0
Access
Public
Updated Jan 21, 2022
Repo size
5 GB
Likes
0
Public
Click a slice to open those files.
.pt5 GB · 100%
From the Hugging Face model README
WudaoSailing is a package for pretraining chinese Language Model and finetune tasks. Now it supports GLM, Bert, T5, Cogview and Roberta models.
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+
nvidia-docker run -id --hostname=V100 --network=host\
--ipc=host --shm-size=16gb --name=deepspeed-cuda \
-e NVIDIA_VISIBLE_DEVICES=0,1,2,3 \
-v /DATA/disk1/docker/containers/:/data deepspeed/cuda102:lastest
or replace cuda102 with cuda112.
docker build -f cuda102.dockerfile -t deepspeed/cuda102 .
git clone https://github.com/wangguojim/WudaoSailing.git
cd WudaoSailing
pip install -r requirements.txt
We show some examples based on GLM model.
We provide scripts for finetuning GLM on some downstream tasks.
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
cd examples/glm/
bash scripts/ds_finetune_superglue.sh\
config/model_blocklm_large_chinese.sh\
config_tasks/task_tnews.sh
cd examples/glm/
bash scripts/ds_finetune_superglue.sh\
config/model_blocklm_large_chinese.sh\
config_tasks/task_copa.sh
DataProcessor in
examples/glm/tasks/superglue/dataset.py for data loading and add a PVP in
examples/glm/tasks/superglue/pvp.py for the cloze question. More details can be found
here.CHECKPOINT_PATH to your local path. Run the following scriptbash config/generate_block.sh\
config/model_blocklm_large_chinese.sh
Context: 凯旋门位于意大利米兰市古城堡旁。1807年为纪念[MASK]而建,门高25米,顶上矗立两武士青铜古兵车铸像。
GLM:拿破仑军队攻克米兰城
Context: 工业互联网(Industrial Internet)是新一代信息通信技术与工业经济深度融合的新型基础设施、应用模式和工业生态,通过对人、机、物、系统等的全面连接,构建起覆盖全产业链、全价值链的全新制造和服务体系,为工业乃至产业数字化、网络化、智能化发展提供了实现途径,是第四次工业革命的重要基石。[sMASK]它以网络为基础、平台为中枢、数据为要素、安全为保障,既是工业数字化、网络化、智能化转型的基础设施,也是互联网、大数据、人工智能与实体经济深度融合的应用模式,同时也是一种新业态、新产业,将重塑企业形态、供应链和产业链。当前,工业互联网融合应用向国民经济重点行业广泛拓展,形成平台化设计、智能化制造、网络化协同、个性化定制、服务化延伸、数字化管理六大新模式,赋能、赋智、赋值作用不断显现,有力的促进了实体经济提质、增效、降本、绿色、安全发展。
GLM: 工业互联网是制造业技术、管理、模式的重大变革,是推动互联网、大数据、人工智能和实体经济深度融合的重要载体,是建设制造强国和网络强国的重要基础。
Context: 问题:高斯所在的国家有什么汽车品牌?答案:[gMASK]
GLM:答案:[gMASK]<|startofpiece|>德国奔驰、德国大众、别克、沃尔沃、斯柯达、本田、雪铁龙.
Run the following script to integrate p-tuning with GLM:
cd algutils/ptuning/
bash finetune_zy.sh
Run the following script to pre-train the GLM-Large model
cd examples/glm/
bash scripts/ds_pretrain_nvidia.sh config/ds_block_large.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.
We show some examples based on GLM model.
Run the following script to pre-train the Bert model
cd examples/bert/
python quick_start.py
Run the following script to pre-train the cogview model
cd examples/cogview/
bash config/pretrain_multiple_nodes.sh
Run the following script to test the ability of text2image
cd examples/cogview/
bash config/text2image_cogview.sh