0


国产开源类ChatGPT模型,ChatGLM-6b初步微调实验

ChatGLM-6b初步微调实验

chatglm-6b微调/推理, 样本为自动生成的整数/小数加减乘除运算, 可gpu/cpu
chatglm-6b fine-tuning/inference, The sample is an automatically generated, integer/decimal of add, sub, mul and div operation, that can be gpu/cpu

项目地址

https://github.com/yongzhuo/chatglm-maths

数据集-中文

踩坑

  1. 1. eps=1e-5(不要改小), 单精度float16, 以及LN采用的是Sandwich-LN(Sandwich LayerNorm), 分支的ATtention前后都有LN, 目的是大模型为了防止梯度溢出等;
  2. 2. 模型输入输出, 默认的tokenization_chatglm.py/modeling_chatglm.py不能用, 因为那是完全为生成generate设置的, 需要自己写好所有缩入参数, 或者机子改成适配的;
  3. 2.1 ChatGLMModel中, get_masks()正常, get_position_ids()函数中‘context_length = seq.index(150004) + 1 改为 context_length = len(seq)’;
  4. 2.2 训练输入input_ids格式暂定为(训练后post-padding, 推理前pre-padding[tokenization_chatglm.py默认pre-padding])
  5. a1. x1: [CLS] + prompt_1 + " " + text_1 + " " + prompt_2 + [gMASK] + [PAD]*N(post-padding)
  6. a2. x2: [SOP] + " " + text_2 + [PAD]*N(post-padding)
  7. a. x = x1 + x2
  8. 2.3 训练输入label_ids格式暂定为(CrossEntropyLoss默认忽略-100不参与计算loss)
  9. b. y = [-100]*len(x) + " " + text_2 + [EOP] + [-100]*N(post-padding)
  10. 2.4 可参考GLM-1, https://github.com/THUDM/GLM/blob/main/tasks/seq2seq/dataset.py
  11. 3. 注意chatglm-6b权重是float16的, 不过计算loss时候会转成float32计算, 最后loss再转回float16更新梯度;
  12. 4. ChatGLMTokenizer有时候会报奇奇怪怪的错误, 建议生成时候设置max_new_tokens, 最大{"max_new_tokens": 2048}; decode有时候会出现不存在id;

环境配置

  1. transformers>=4.26.1
  2. cpm_kernels==1.0.11
  3. icetk==0.0.4
  4. torch>=1.10.1
  5. rouge==1.0.1
  6. nltk==3.6.6
  7. numpy
  8. tqdm
  9. lion_pytorch

微调-计算题

  1. 6b
  2. 微调: python c00_toy_cpu_train_6b.py
  3. 推理: python p00_toy_cpu_predit_6b.py
  4. small-layer
  5. 微调: python c01_toy_cpu_train_small.py
  6. 推理: python p01_toy_cpu_predict_small.py

参考/感谢

推理日志toy

  1. generator_calculate_line: ('13+75=', '13+75=88')
  2. tokenizer.vocab_size: 150344
  3. eval: 0%| | 0/1 [00:00<?, ?it/s]batch_query: ['简便运算: 98+83= 剖析: 98+83=181']
  4. batch_qtext_0: 简便运算: 98+83= 剖析:
  5. batch_qans_0: 98+83=181
  6. response_0: 98+83=171
  7. {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  8. 请输入:
  9. 25.31+86.35=
  10. 请稍等...
  11. 25.31+86.35=101.66

微调日志toy

  1. generator_calculate_line: ('13+75=', '13+75=88')
  2. tokenizer.vocab_size: 150344
  3. Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:10<00:00, 1.31s/it]
  4. transformer.word_embeddings.weight False
  5. ......
  6. transformer.layers.26.mlp.dense_4h_to_h.bias False
  7. transformer.layers.27.input_layernorm.weight True
  8. transformer.layers.27.input_layernorm.bias True
  9. transformer.layers.27.attention.query_key_value.weight True
  10. transformer.layers.27.attention.query_key_value.bias True
  11. transformer.layers.27.attention.dense.weight True
  12. transformer.layers.27.attention.dense.bias True
  13. transformer.layers.27.post_attention_layernorm.weight True
  14. transformer.layers.27.post_attention_layernorm.bias True
  15. transformer.layers.27.mlp.dense_h_to_4h.weight True
  16. transformer.layers.27.mlp.dense_h_to_4h.bias True
  17. transformer.layers.27.mlp.dense_4h_to_h.weight True
  18. transformer.layers.27.mlp.dense_4h_to_h.bias True
  19. transformer.final_layernorm.weight True
  20. transformer.final_layernorm.bias True
  21. model.chat start
  22. 13+75=88, but that's not the correct answer. The correct answer is 13+75=88, which is 90.
  23. /anaconda3/envs/py371/lib/python3.7/site-packages/transformers/optimization.py:395: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning
  24. FutureWarning,
  25. epoch: 0%| | 0/21 [00:00<?, ?it/s]epochs:
  26. batch_query: ['简便运算: 98+83= 剖析: 98+83=181'] | 0/8 [00:00<?, ?it/s]
  27. epoch_global: 0, step_global: 1, step: 0, loss: 4.0625
  28. batch_query: ['口算: 57.84+13.64 解: 57.84+13.64=71.48']
  29. epoch_global: 0, step_global: 2, step: 1, loss: 2.5625███▌ | 2/8 [00:17<00:51, 8.54s/it]
  30. batch_query: ['计算题: 48+1 解答: 48+1=49']
  31. epoch_global: 0, step_global: 3, step: 2, loss: 4.15625█████████████████████▎ | 3/8 [00:38<01:09, 13.94s/it]
  32. batch_query: ['计算题: 61.65+33.05 解答: 61.65+33.05=94.7']
  33. epoch_global: 0, step_global: 4, step: 3, loss: 2.40625████████████████████████████████████████ | 4/8 [01:01<01:09, 17.43s/it]
  34. batch_query: ['计算: 81+75 回答: 81+75=156']
  35. epoch_global: 0, step_global: 5, step: 4, loss: 3.546875█████████████████████████████████████████████████████████▊ | 5/8 [01:27<01:01, 20.41s/it]
  36. epoch: 5%|███████▎ | 1/21 [03:07<1:02:30, 187.52s/it]epochs: step: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [02:41<00:00, 23.15s/it]
  37. epoch_0_step: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [03:07<00:00, 23.44s/it]
  38. batch_query: ['问题: 99+37 答案: 99+37=136']
  39. epoch_global: 1, step_global: 9, step: 0, loss: 3.640625 | 0/8 [00:00<?, ?it/s]
  40. batch_query: ['问题: 26.81+55.91 答案: 26.81+55.91=82.72'] | 0/1 [00:00<?, ?it/s]
  41. batch_qtext_0: 问题: 26.81+55.91 答案:
  42. batch_qans_0: 26.81+55.91=82.72
  43. response_0: 26.81+55.91=83.72
  44. {'rouge-1': 0.749999995, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.749999995, 'bleu': 0.0}
  45. epoch_global: 1, step_global: 9, step: 0
  46. best_score_avg: 0.45833
  47. current_mertics: {'rouge-1': 0.749999995, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.749999995, 'bleu': 0.0}
  48. batch_query: ['数学题: 23.34+68.45 点拨: 23.34+68.45=91.79']
  49. epoch_global: 1, step_global: 10, step: 1, loss: 2.09375
  50. batch_query: ['计算: 77+14 回答: 77+14=91']█████████████▌ | 2/8 [00:33<01:39, 16.58s/it]
  51. epoch_global: 1, step_global: 11, step: 2, loss: 3.265625
  52. batch_query: ['口算: 79.69+17.43= 解: 79.69+17.43=97.12']██████████████████▎ | 3/8 [00:35<00:53, 10.75s/it]
  53. epoch_global: 1, step_global: 12, step: 3, loss: 2.171875
  54. batch_query: ['简便运算: 59.67+86.73 剖析: 59.67+86.73=146.4']████████████████████████████████ | 4/8 [00:37<00:29, 7.43s/it]
  55. epoch_global: 1, step_global: 13, step: 4, loss: 2.328125
  56. epoch: 10%|██████████████▊ | 2/21 [03:56<33:33, 105.97s/it]epochs:
  57. epoch_1_step: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:48<00:00, 6.11s/it]
  58. batch_query: ['初等数学: 24.29+76.26 解析: 24.29+76.26=100.55']
  59. epoch_global: 2, step_global: 17, step: 0, loss: 2.046875
  60. epoch_2_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['计算题: 69.85+28.46= 解答: 69.85+28.46=98.31']
  61. batch_qtext_0: 计算题: 69.85+28.46= 解答: | 0/1 [00:00<?, ?it/s]
  62. batch_qans_0: 69.85+28.46=98.31
  63. response_0: 69.85+28.46=97.21
  64. {'rouge-1': 0.4999999950000001, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.4999999950000001, 'bleu': 0.0}
  65. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:07<00:00, 7.83s/it]
  66. epoch_global: 2, step_global: 17, step: 0
  67. best_score_avg: 0.33333
  68. current_mertics: {'rouge-1': 0.4999999950000001, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.4999999950000001, 'bleu': 0.0}
  69. batch_query: ['问题: 113.79+81.78= 答案: 113.79+81.78=195.57']
  70. epoch_global: 2, step_global: 18, step: 1, loss: 1.8515625
  71. batch_query: ['计算: 10.74+17.87= 回答: 10.74+17.87=28.61']
  72. epoch_2_step: 25%|█████████████████████████████████████▌ | 2/8 [00:10<00:31, 5.21s/itepoch_global: 2, step_global: 19, step: 2, loss: 1.8203125
  73. batch_query: ['计算: 11.64+25.07= 回答: 11.64+25.07=36.71']
  74. epoch_2_step: 38%|████████████████████████████████████████████████████████▎ | 3/8 [00:13<00:20, 4.15s/itepoch_global: 2, step_global: 20, step: 3, loss: 1.859375
  75. batch_query: ['口算: 53.08+54.9 解: 53.08+54.9=107.98']
  76. epoch_2_step: 50%|███████████████████████████████████████████████████████████████████████████ | 4/8 [00:15<00:14, 3.58s/itepoch_global: 2, step_global: 21, step: 4, loss: 2.078125
  77. epoch: 14%|██████████████████████▎ | 3/21 [04:23<20:56, 69.80s/it]epochs: step: 62%|█████████████████████████████████████████████████████████████████████████████████████████████▊ | 5/8 [00:18<00:09, 3.28s/it]
  78. epoch_2_step: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:26<00:00, 3.34s/it]
  79. batch_query: ['初等数学: 102.7+68.21= 解析: 102.7+68.21=170.91']█████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:24<00:00, 2.44s/it]
  80. epoch_global: 3, step_global: 25, step: 0, loss: 1.5390625 | 0/8 [00:00<?, ?it/s]
  81. batch_query: ['数学题: 94+19 点拨: 94+19=113']
  82. batch_qtext_0: 数学题: 94+19 点拨:
  83. batch_qans_0: 94+19=113 | 0/1 [00:00<?, ?it/s]
  84. response_0: 94+19=103
  85. {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  86. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:04<00:00, 4.11s/it]
  87. epoch_global: 3, step_global: 25, step: 0
  88. best_score_avg: 0.0
  89. current_mertics: {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  90. batch_query: ['数学题: 37.94+23.99 点拨: 37.94+23.99=61.93']
  91. epoch_global: 3, step_global: 26, step: 1, loss: 1.578125
  92. batch_query: ['问: 51.16+14.21= 答: 51.16+14.21=65.37']█▌ | 2/8 [00:06<00:20, 3.41s/it]
  93. epoch_global: 3, step_global: 27, step: 2, loss: 1.7265625
  94. batch_query: ['问题: 13.89+40.09 答案: 13.89+40.09=53.98']█████████████████▎ | 3/8 [00:09<00:15, 3.08s/it]
  95. epoch_global: 3, step_global: 28, step: 3, loss: 1.9765625
  96. batch_query: ['口算: 68+33 解: 68+33=101']████████████████████████████████████████████████████ | 4/8 [00:11<00:11, 2.83s/it]
  97. epoch_global: 3, step_global: 29, step: 4, loss: 3.125
  98. epoch: 19%|█████████████████████████████▋ | 4/21 [04:45<14:29, 51.16s/it]epochs:
  99. epoch_3_step: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:22<00:00, 2.82s/it]
  100. batch_query: ['简便运算: 52+48 剖析: 52+48=100']
  101. epoch_global: 4, step_global: 33, step: 0, loss: 2.921875
  102. epoch_4_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['口算: 11.71+0.36= 解: 11.71+0.36=12.07']
  103. batch_qtext_0: 口算: 11.71+0.36= 解: | 0/1 [00:00<?, ?it/s]
  104. batch_qans_0: 11.71+0.36=12.07
  105. response_0: 11.71+0.36=12.07
  106. {'rouge-1': 0.999999995, 'rouge-2': 0.999999995, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  107. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:06<00:00, 6.65s/it]
  108. epoch_global: 4, step_global: 33, step: 0
  109. best_score_avg: 0.79446
  110. current_mertics: {'rouge-1': 0.999999995, 'rouge-2': 0.999999995, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  111. batch_query: ['计算题: 40.29+76.09 解答: 40.29+76.09=116.38']
  112. epoch_global: 4, step_global: 34, step: 1, loss: 1.40625
  113. batch_query: ['计算: 64+26= 回答: 64+26=90']
  114. epoch_4_step: 25%|█████████████████████████████████████▌ | 2/8 [00:27<01:23, 13.96s/itepoch_global: 4, step_global: 35, step: 2, loss: 2.328125
  115. batch_query: ['问题: 48.54+9.56 答案: 48.54+9.56=58.1']
  116. epoch_4_step: 38%|████████████████████████████████████████████████████████▎ | 3/8 [00:30<00:46, 9.32s/itepoch_global: 4, step_global: 36, step: 3, loss: 1.90625
  117. batch_query: ['计算题: 119.42+26.14 解答: 119.42+26.14=145.56']
  118. epoch_4_step: 50%|███████████████████████████████████████████████████████████████████████████ | 4/8 [00:32<00:26, 6.54s/itepoch_global: 4, step_global: 37, step: 4, loss: 1.5859375
  119. epoch: 24%|█████████████████████████████████████▏ | 5/21 [05:29<12:57, 48.61s/it]epochs: step: 62%|█████████████████████████████████████████████████████████████████████████████████████████████▊ | 5/8 [00:34<00:15, 5.06s/it]
  120. epoch_4_step: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:44<00:00, 5.51s/it]
  121. batch_query: ['计算题: 72+55 解答: 72+55=127']███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:42<00:00, 3.30s/it]
  122. epoch_global: 5, step_global: 41, step: 0, loss: 2.21875 | 0/8 [00:00<?, ?it/s]
  123. batch_query: ['计算: 54.37+23.56= 回答: 54.37+23.56=77.93']
  124. batch_qtext_0: 计算: 54.37+23.56= 回答:
  125. batch_qans_0: 54.37+23.56=77.93 | 0/1 [00:00<?, ?it/s]
  126. response_0: 54.37+23.56=87.03
  127. {'rouge-1': 0.4999999950000001, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.4999999950000001, 'bleu': 0.0}
  128. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:06<00:00, 6.04s/it]
  129. epoch_global: 5, step_global: 41, step: 0
  130. best_score_avg: 0.33333
  131. current_mertics: {'rouge-1': 0.4999999950000001, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.4999999950000001, 'bleu': 0.0}
  132. batch_query: ['初等数学: 11.66+124.17 解析: 11.66+124.17=135.83']
  133. epoch_global: 5, step_global: 42, step: 1, loss: 1.140625
  134. batch_query: ['简便运算: 32.31+93.5= 剖析: 32.31+93.5=125.81'] | 2/8 [00:07<00:23, 3.97s/it]
  135. epoch_global: 5, step_global: 43, step: 2, loss: 2.03125
  136. batch_query: ['计算题: 10+40 解答: 10+40=50']██████████████████████████████▎ | 3/8 [00:10<00:17, 3.41s/it]
  137. epoch_global: 5, step_global: 44, step: 3, loss: 2.28125
  138. batch_query: ['数学题: 26.19+58.61 点拨: 26.19+58.61=84.8']███████████████████████████████████ | 4/8 [00:13<00:12, 3.09s/it]
  139. epoch_global: 5, step_global: 45, step: 4, loss: 1.515625
  140. epoch: 29%|████████████████████████████████████████████▌ | 6/21 [05:54<10:07, 40.50s/it]epochs:
  141. epoch_5_step: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:24<00:00, 3.09s/it]
  142. batch_query: ['简便运算: 83.94+43.41= 剖析: 83.94+43.41=127.35']
  143. epoch_global: 6, step_global: 49, step: 0, loss: 1.6640625
  144. epoch_6_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['问: 10+17= 答: 10+17=27']
  145. batch_qtext_0: 问: 10+17= 答: | 0/1 [00:00<?, ?it/s]
  146. batch_qans_0: 10+17=27
  147. response_0: 10+17=27
  148. {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  149. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:03<00:00, 3.13s/it]
  150. epoch_global: 6, step_global: 49, step: 0
  151. best_score_avg: 0.54446
  152. current_mertics: {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  153. batch_query: ['数学题: 77.73+51.97= 点拨: 77.73+51.97=129.7']
  154. epoch_global: 6, step_global: 50, step: 1, loss: 1.3671875
  155. batch_query: ['口算: 57+56= 解: 57+56=113']
  156. epoch_6_step: 25%|█████████████████████████████████████▌ | 2/8 [00:05<00:17, 2.86s/itepoch_global: 6, step_global: 51, step: 2, loss: 3.125
  157. batch_query: ['问题: 59+24 答案: 59+24=83']
  158. epoch_6_step: 38%|████████████████████████████████████████████████████████▎ | 3/8 [00:08<00:13, 2.70s/itepoch_global: 6, step_global: 52, step: 3, loss: 2.671875
  159. batch_query: ['计算题: 73+64 解答: 73+64=137']
  160. epoch_6_step: 50%|███████████████████████████████████████████████████████████████████████████ | 4/8 [00:09<00:09, 2.36s/itepoch_global: 6, step_global: 53, step: 4, loss: 1.90625
  161. epoch: 33%|████████████████████████████████████████████████████ | 7/21 [06:13<07:49, 33.51s/it]epochs: step: 62%|█████████████████████████████████████████████████████████████████████████████████████████████▊ | 5/8 [00:11<00:06, 2.14s/it]
  162. epoch_6_step: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:19<00:00, 2.39s/it]
  163. batch_query: ['问题: 3+79 答案: 3+79=82']████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:17<00:00, 1.96s/it]
  164. epoch_global: 7, step_global: 57, step: 0, loss: 3.328125 | 0/8 [00:00<?, ?it/s]
  165. batch_query: ['计算题: 21.6+4.99 解答: 21.6+4.99=26.59']
  166. batch_qtext_0: 计算题: 21.6+4.99 解答:
  167. batch_qans_0: 21.6+4.99=26.59 | 0/1 [00:00<?, ?it/s]
  168. response_0: 21.6+4.99=26.67
  169. {'rouge-1': 0.749999995, 'rouge-2': 0.6666666616666668, 'rouge-l': 0.749999995, 'bleu': 0.0}
  170. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:05<00:00, 5.84s/it]
  171. epoch_global: 7, step_global: 57, step: 0
  172. best_score_avg: 0.54167
  173. current_mertics: {'rouge-1': 0.749999995, 'rouge-2': 0.6666666616666668, 'rouge-l': 0.749999995, 'bleu': 0.0}
  174. epoch: 38%|███████████████████████████████████████████████████████████▍ | 8/21 [06:21<05:28, 25.27s/it]epochs:
  175. epoch_7_step: 12%|██████████████████▊ | 1/8 [00:07<00:53, 7.62s/it]
  176. batch_query: ['简便运算: 32.25+31.24= 剖析: 32.25+31.24=63.49']
  177. epoch_global: 8, step_global: 58, step: 0, loss: 1.640625
  178. epoch_8_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['简便运算: 4+18 剖析: 4+18=22']
  179. batch_qtext_0: 简便运算: 4+18 剖析: | 0/1 [00:00<?, ?it/s]
  180. batch_qans_0: 4+18=22
  181. response_0: 4+18=22
  182. {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  183. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:03<00:00, 3.43s/it]
  184. epoch_global: 8, step_global: 58, step: 0
  185. best_score_avg: 0.54446
  186. current_mertics: {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  187. epoch: 43%|██████████████████████████████████████████████████████████████████▊ | 9/21 [06:27<03:51, 19.26s/it]epochs:
  188. epoch_8_step: 12%|██████████████████▊ | 1/8 [00:06<00:42, 6.05s/it]
  189. batch_query: ['口算: 56.12+87.86= 解: 56.12+87.86=143.98']
  190. epoch_global: 9, step_global: 59, step: 0, loss: 1.65625 | 0/8 [00:00<?, ?it/s]
  191. batch_query: ['问: 84.48+26.75= 答: 84.48+26.75=111.23']
  192. batch_qtext_0: 问: 84.48+26.75= 答:
  193. batch_qans_0: 84.48+26.75=111.23 | 0/1 [00:00<?, ?it/s]
  194. response_0: 84.48+26.75=101.13
  195. {'rouge-1': 0.4999999950000001, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.4999999950000001, 'bleu': 0.0}
  196. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:06<00:00, 6.06s/it]
  197. epoch_global: 9, step_global: 59, step: 0
  198. best_score_avg: 0.33333
  199. current_mertics: {'rouge-1': 0.4999999950000001, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.4999999950000001, 'bleu': 0.0}
  200. epoch: 48%|█████████████████████████████████████████████████████████████████████████▊ | 10/21 [06:35<02:55, 15.95s/it]epochs:
  201. epoch_9_step: 12%|██████████████████▊ | 1/8 [00:08<00:59, 8.55s/it]
  202. batch_query: ['计算: 76.94+92.36= 回答: 76.94+92.36=169.3']
  203. epoch_global: 10, step_global: 60, step: 0, loss: 1.7421875
  204. epoch_10_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['初等数学: 91+38= 解析: 91+38=129']
  205. batch_qtext_0: 初等数学: 91+38= 解析: | 0/1 [00:00<?, ?it/s]
  206. batch_qans_0: 91+38=129
  207. response_0: 91+38=129
  208. {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  209. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:03<00:00, 3.50s/it]
  210. epoch_global: 10, step_global: 60, step: 0
  211. best_score_avg: 0.54446
  212. current_mertics: {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  213. epoch: 52%|█████████████████████████████████████████████████████████████████████████████████▏ | 11/21 [06:41<02:08, 12.89s/it]epochs:
  214. epoch_10_step: 12%|██████████████████▋ | 1/8 [00:05<00:41, 5.93s/it]
  215. batch_query: ['问题: 23.29+19.33 答案: 23.29+19.33=42.62']
  216. epoch_global: 11, step_global: 61, step: 0, loss: 1.921875 | 0/8 [00:00<?, ?it/s]
  217. batch_query: ['问: 62+93 答: 62+93=155']
  218. batch_qtext_0: 问: 62+93 答:
  219. batch_qans_0: 62+93=155 | 0/1 [00:00<?, ?it/s]
  220. response_0: 62+93=155
  221. {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  222. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:03<00:00, 3.33s/it]
  223. epoch_global: 11, step_global: 61, step: 0
  224. best_score_avg: 0.54446
  225. current_mertics: {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  226. epoch: 57%|████████████████████████████████████████████████████████████████████████████████████████▌ | 12/21 [06:47<01:36, 10.70s/it]epochs:
  227. epoch_11_step: 12%|██████████████████▋ | 1/8 [00:05<00:39, 5.70s/it]
  228. batch_query: ['口算: 22.22+37.01 解: 22.22+37.01=59.23']
  229. epoch_global: 12, step_global: 62, step: 0, loss: 1.7109375
  230. epoch_12_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['口算: 7+24= 解: 7+24=31']
  231. batch_qtext_0: 口算: 7+24= 解: | 0/1 [00:00<?, ?it/s]
  232. batch_qans_0: 7+24=31
  233. response_0: 7+24=29
  234. {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  235. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00, 2.83s/it]
  236. epoch_global: 12, step_global: 62, step: 0
  237. best_score_avg: 0.0
  238. current_mertics: {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  239. epoch: 62%|███████████████████████████████████████████████████████████████████████████████████████████████▉ | 13/21 [06:52<01:12, 9.03s/it]epochs:
  240. epoch_12_step: 12%|██████████████████▋ | 1/8 [00:05<00:36, 5.17s/it]
  241. batch_query: ['计算题: 48+5= 解答: 48+5=53']
  242. epoch_global: 13, step_global: 63, step: 0, loss: 2.15625 | 0/8 [00:00<?, ?it/s]
  243. batch_query: ['简便运算: 5+68= 剖析: 5+68=73']
  244. batch_qtext_0: 简便运算: 5+68= 剖析:
  245. batch_qans_0: 5+68=73 | 0/1 [00:00<?, ?it/s]
  246. response_0: 要简化这个算式,我们可以使用分配律,即:a+b=b+a。因此,5+68=68+5=73。
  247. 我们也可以使用长除法,将68除以5,
  248. {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  249. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:41<00:00, 41.89s/it]
  250. epoch_global: 13, step_global: 63, step: 0
  251. best_score_avg: 0.0
  252. current_mertics: {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  253. epoch: 67%|███████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 14/21 [07:36<02:16, 19.48s/it]epochs:
  254. epoch_13_step: 12%|██████████████████▋ | 1/8 [00:43<05:05, 43.65s/it]
  255. batch_query: ['计算题: 25.31+86.35 解答: 25.31+86.35=111.66']
  256. epoch_global: 14, step_global: 64, step: 0, loss: 1.1796875
  257. epoch_14_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['口算: 4+44= 解: 4+44=48']
  258. batch_qtext_0: 口算: 4+44= 解: | 0/1 [00:00<?, ?it/s]
  259. batch_qans_0: 4+44=48
  260. response_0: 4+44=48
  261. {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  262. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00, 2.79s/it]
  263. epoch_global: 14, step_global: 64, step: 0
  264. best_score_avg: 0.54446
  265. current_mertics: {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  266. epoch: 71%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 15/21 [07:41<01:31, 15.20s/it]epochs:
  267. epoch_14_step: 12%|██████████████████▋ | 1/8 [00:05<00:36, 5.28s/it]
  268. batch_query: ['计算题: 53+79= 解答: 53+79=132']
  269. epoch_global: 15, step_global: 65, step: 0, loss: 1.9453125 | 0/8 [00:00<?, ?it/s]
  270. batch_query: ['简便运算: 69+85 剖析: 69+85=154']
  271. batch_qtext_0: 简便运算: 69+85 剖析:
  272. batch_qans_0: 69+85=154 | 0/1 [00:00<?, ?it/s]
  273. response_0: 要简便运算,我们可以采用因数分解和通分的方法。
  274. 首先,将两个数进行因数分解:
  275. 69=3×33
  276. 85=5×53
  277. 然后,将两个
  278. {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  279. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:53<00:00, 53.75s/it]
  280. epoch_global: 15, step_global: 65, step: 0
  281. best_score_avg: 0.0
  282. current_mertics: {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  283. epoch: 76%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 16/21 [08:37<02:16, 27.36s/it]epochs:
  284. epoch_15_step: 12%|██████████████████▋ | 1/8 [00:55<06:29, 55.59s/it]
  285. batch_query: ['问题: 11+28 答案: 11+28=39']
  286. epoch_global: 16, step_global: 66, step: 0, loss: 2.609375
  287. epoch_16_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['问: 5.65+10.67 答: 5.65+10.67=16.32']
  288. batch_qtext_0: 问: 5.65+10.67 答: | 0/1 [00:00<?, ?it/s]
  289. batch_qans_0: 5.65+10.67=16.32
  290. response_0: 5.65+10.67=16.32
  291. {'rouge-1': 0.999999995, 'rouge-2': 0.999999995, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  292. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:04<00:00, 4.89s/it]
  293. epoch_global: 16, step_global: 66, step: 0
  294. best_score_avg: 0.79446
  295. current_mertics: {'rouge-1': 0.999999995, 'rouge-2': 0.999999995, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  296. epoch: 81%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 17/21 [08:43<01:24, 21.15s/it]epochs:
  297. epoch_16_step: 12%|██████████████████▋ | 1/8 [00:06<00:47, 6.72s/it]
  298. batch_query: ['口算: 20+7= 解: 20+7=27']
  299. epoch_global: 17, step_global: 67, step: 0, loss: 3.328125 | 0/8 [00:00<?, ?it/s]
  300. batch_query: ['问题: 92.68+38.52= 答案: 92.68+38.52=131.2']
  301. batch_qtext_0: 问题: 92.68+38.52= 答案:
  302. batch_qans_0: 92.68+38.52=131.2 | 0/1 [00:00<?, ?it/s]
  303. response_0: 92.68+38.52=131.20
  304. {'rouge-1': 0.749999995, 'rouge-2': 0.6666666616666668, 'rouge-l': 0.749999995, 'bleu': 0.0}
  305. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:05<00:00, 5.39s/it]
  306. epoch_global: 17, step_global: 67, step: 0
  307. best_score_avg: 0.54167
  308. current_mertics: {'rouge-1': 0.749999995, 'rouge-2': 0.6666666616666668, 'rouge-l': 0.749999995, 'bleu': 0.0}
  309. epoch: 86%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 18/21 [08:50<00:50, 16.90s/it]epochs:
  310. epoch_17_step: 12%|██████████████████▋ | 1/8 [00:06<00:48, 6.99s/it]
  311. batch_query: ['简便运算: 54.87+42.4= 剖析: 54.87+42.4=97.27']
  312. epoch_global: 18, step_global: 68, step: 0, loss: 1.7734375
  313. epoch_18_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['计算题: 58.63+36.22= 解答: 58.63+36.22=94.85']
  314. batch_qtext_0: 计算题: 58.63+36.22= 解答: | 0/1 [00:00<?, ?it/s]
  315. batch_qans_0: 58.63+36.22=94.85
  316. response_0: 58.63+36.22=114.85
  317. {'rouge-1': 0.749999995, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.749999995, 'bleu': 0.0}
  318. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:05<00:00, 5.30s/it]
  319. epoch_global: 18, step_global: 68, step: 0
  320. best_score_avg: 0.45833
  321. current_mertics: {'rouge-1': 0.749999995, 'rouge-2': 0.3333333283333334, 'rouge-l': 0.749999995, 'bleu': 0.0}
  322. epoch: 90%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 19/21 [08:58<00:28, 14.15s/it]epochs:
  323. epoch_18_step: 12%|██████████████████▋ | 1/8 [00:07<00:54, 7.76s/it]
  324. batch_query: ['初等数学: 61.35+15.18 解析: 61.35+15.18=76.53']
  325. epoch_global: 19, step_global: 69, step: 0, loss: 1.6953125 | 0/8 [00:00<?, ?it/s]
  326. batch_query: ['简便运算: 65+92= 剖析: 65+92=157']
  327. batch_qtext_0: 简便运算: 65+92= 剖析:
  328. batch_qans_0: 65+92=157 | 0/1 [00:00<?, ?it/s]
  329. response_0: 要简便运算,我们需要知道将要计算的数的位数和个位上的数。在这个例子中,我们已经知道了个位上的数是9,我们需要将这个数转换为十进制
  330. {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  331. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:26<00:00, 26.37s/it]
  332. epoch_global: 19, step_global: 69, step: 0
  333. best_score_avg: 0.0
  334. current_mertics: {'rouge-1': 0.0, 'rouge-2': 0.0, 'rouge-l': 0.0, 'bleu': 0.0}
  335. epoch: 95%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 20/21 [09:27<00:18, 18.57s/it]epochs:
  336. epoch_19_step: 12%|██████████████████▋ | 1/8 [00:28<03:22, 28.86s/it]
  337. batch_query: ['问: 86.6+44.32= 答: 86.6+44.32=130.92']
  338. epoch_global: 20, step_global: 70, step: 0, loss: 1.5546875
  339. epoch_20_step: 0%| | 0/8 [00:00<?, ?it/sbatch_query: ['计算: 87+12= 回答: 87+12=99']
  340. batch_qtext_0: 计算: 87+12= 回答: | 0/1 [00:00<?, ?it/s]
  341. batch_qans_0: 87+12=99
  342. response_0: 87+12=99
  343. {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  344. eval: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00, 2.82s/it]
  345. epoch_global: 20, step_global: 70, step: 0
  346. best_score_avg: 0.54446
  347. current_mertics: {'rouge-1': 0.999999995, 'rouge-2': 0.0, 'rouge-l': 0.999999995, 'bleu': 0.1778279410038923}
  348. epoch: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 21/21 [09:32<00:00, 27.27s/it]
  349. eval: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [06:22<00:00, 382.93s/it]
  350. epoch_20_step: 12%|██████████████████▋ | 1/8 [00:06<00:45, 6.45s/it]

本文转载自: https://blog.csdn.net/rensihui/article/details/129705526
版权归原作者 Macropodus 所有, 如有侵权,请联系我们删除。

“国产开源类ChatGPT模型,ChatGLM-6b初步微调实验”的评论:

还没有评论