首页 > 其他分享 >[本科项目实训] P-Tuning v2 测试记录

[本科项目实训] P-Tuning v2 测试记录

时间:2024-06-24 12:43:36浏览次数:3  
标签:Tuning -- token predict v2 64 实训 rouge output

测试脚本

PRE_SEQ_LEN=64
CHECKPOINT=dsbtpg-chatglm-6b-pt-64-2e-2
STEP=500

CUDA_VISIBLE_DEVICES=0 python3 main.py \
    --do_predict \
    --validation_file devVX.json \
    --test_file devVX.json \
    --overwrite_cache \
    --prompt_column content \
    --response_column summary \
    --model_name_or_path /home/lyc/workspace/ChatGLM-6B/chatglm-6b \
    --ptuning_checkpoint ./output/$CHECKPOINT/checkpoint-$STEP \
    --output_dir ./output/$CHECKPOINT \
    --overwrite_output_dir \
    --max_source_length 64 \
    --max_target_length 64 \
    --per_device_eval_batch_size 1 \
    --predict_with_generate \
    --pre_seq_len $PRE_SEQ_LEN \
    --quantization_bit 8

测试过程

 99%|████████████████████████████████████████████████████████████████████████████████▍| 139/140 [01:50<00:00,  1.27it/s][INFO|configuration_utils.py:575] 2024-05-21 13:41:44,210 >> Generate config GenerationConfig {
  "_from_model_config": true,
  "bos_token_id": 130004,
  "eos_token_id": 130005,
  "pad_token_id": 3,
  "transformers_version": "4.27.1"
}

100%|█████████████████████████████████████████████████████████████████████████████████| 140/140 [01:51<00:00,  1.27it/s]Building prefix dict from the default dictionary ...
05/21/2024 13:41:45 - DEBUG - jieba - Building prefix dict from the default dictionary ...
Dumping model to file cache /tmp/jieba.cache
05/21/2024 13:41:45 - DEBUG - jieba - Dumping model to file cache /tmp/jieba.cache
Loading model cost 0.680 seconds.
05/21/2024 13:41:45 - DEBUG - jieba - Loading model cost 0.680 seconds.
Prefix dict has been built successfully.
05/21/2024 13:41:45 - DEBUG - jieba - Prefix dict has been built successfully.
100%|█████████████████████████████████████████████████████████████████████████████████| 140/140 [01:51<00:00,  1.25it/s]
***** predict metrics *****
  predict_bleu-4             =    76.3107
  predict_rouge-1            =    83.1915
  predict_rouge-2            =    77.6409
  predict_rouge-l            =    91.1686
  predict_runtime            = 0:01:53.47
  predict_samples            =        140
  predict_samples_per_second =      1.234
  predict_steps_per_second   =      1.234

main.py的evaluate脚本可以在指定数据集上评估微调后模型的好坏,其使用了BLUEROUGE两个经典的指标,前者通过比较机器翻译结果和人工翻译结果之间的 n-gram 匹配度来计算相似度,后者通过计算摘要中单词或短语的召回率来评估摘要的质量,两者都分数越高,模型表现质量越好。

注:这里由于训练问题重新训练了,上述数据仅作为格式展示,重跑后结果为:

***** predict metrics *****
  predict_bleu-4             =    99.3069
  predict_rouge-1            =     99.449
  predict_rouge-2            =    99.3863
  predict_rouge-l            =    99.7142
  predict_runtime            = 0:02:19.46
  predict_samples            =        168
  predict_samples_per_second =      1.205
  predict_steps_per_second   =      1.205

参考资料

[1] 机器翻译与自动文摘评价指标 BLEU 和 ROUGE:如何理解和应用-百度开发者中心 (baidu.com)

标签:Tuning,--,token,predict,v2,64,实训,rouge,output
From: https://www.cnblogs.com/yichengliu0219/p/18264222

相关文章

  • [本科项目实训] P-Tuning v2 训练记录
    训练脚本PRE_SEQ_LEN=64LR=2e-2CUDA_VISIBLE_DEVICES=0python3main.py\--do_train\--train_filetrainVX.json\--validation_filedevVX.json\--prompt_columncontent\--response_columnsummary\--overwrite_cache\--mo......
  • [本科项目实训] 模型量化技术
    概述模型量化作为一种能够有效减少模型大小,加速深度学习推理的优化技术,主要包含8/4/2/1bit等精度设置。在8-bit低精度推理中,我们将一个原本FP32的weight/activation浮点数张量转化成一个int8/uint8张量,从而减少内存带宽和存储空间,并提高系统吞吐量降低系统时延。[2]......
  • [本科项目实训] Hugging Face Transformers 模型部署与微调
    TransformersHuggingFaceTransformer提供了模型的加载、推理、微调接口,使用该库可以轻松完成自然语言模型的部署微调工作,其有继承自AutoClass的四个最为常见的接口,且调用方式均为AutoClass.from_pretrain("model_name"):AutoTokenizer:用于文本分词AutoFeatureExtractor:用......
  • [本科项目实训] ChatGLM3 与 ChatGLM4 简述
    ChatGLM3-6B简述ChatGLM3-6B是ChatGLM系列最新一代的开源模型,在保留了前两代模型对话流畅、部署门槛低等众多优秀特性的基础上,ChatGLM3-6B引入了如下特性:更强大的基础模型:ChatGLM3-6B的基础模型ChatGLM3-6B-Base采用了更多样的训练数据、更充分的训练步数和更合理的......
  • 创新实训 (九)CodeForces 数据和微调数据处理
    Codeforces数据获取Codeforces的题目中存在一些数学公式,所以处理的时候需要比较小心的对其进行处理。首先是题面数据,在CF当中标识一道题目的方式是problemSet与problemId。其中problemSet是一个数字,而problemId是一个字母。另外需要注意的是CF题面中存在许多数学......
  • 创新实训 (十)大模型微调
    1.数据部分CodeGeeX基于ChatGLM基座语言模型,所以需要关注ChatGLM的训练数据。训练数据为jsonl格式,每一行的数据格式如下,其中chat_rounds字段是必需的,可以根据实际需求添加或删除其他字段。在本项目当中,我们更加关注的是模型的单轮对话能力,所以只需要单轮对话数据。推理......
  • 创新实训(十)——代码美化部分:导航栏的active
    代码美化部分————导航栏的active对于导航栏来说,当选定在某个功能部分时,当前模块会有高亮显示。查看main-nav.php中有管导航栏的代码<divclass="collapsenavbar-collapse"id="navbarSupportedContent"> <ulclass="navnav-pillsmain-navmr-auto"> <liclass="......
  • 【openGauss、PostgreSQL】openGauss、PostgreSQL数据库通用查表字段信息脚本-v202406
    【openGauss、PostgreSQL】openGauss、PostgreSQL数据库通用查表字段信息脚本-v20240620-2216openGauss、PostgreSQL数据库通用查表字段信息脚本-v20240620-2216openGauss、PostgreSQL数据库通用查表字段信息脚本-v20240620-2216此脚本,openGauss、PostgreSQL都可执......
  • 电影《绝地战警:生死与共》迅雷BT选择[高清版百度云下载/MKV2.88GB][中英双字资源]
    《绝地战警:生死与共》:一场华丽的动作盛宴电影《绝地战警:生死与共》是一部由导演马丁·坎贝尔执导、克里斯·塔克和杰克·切尼主演的动作喜剧片。该片于2021年上映,以其惊险刺激的动作场面和幽默风格赢得了广大观众的喜爱。 故事发生在现代繁华的洛杉矶市,克里斯·塔克......
  • 创新实训(八)——题目相关的逻辑处理解释
    题目部分题目是整个OJ系统的练习基础,无论是平时学生的练习还是比赛时的准备用题,题目系统在OJ中都是至关重要的。在controllers文件夹下,负责题目部分的代码文件分别为:problem_set.php,problem.php,problem_statistics.php,problem_data_manage.php,problem_statement_manage.php,p......