Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • PaddlePaddle
  • ERNIE
  • Issue
  • #397

E
ERNIE
  • 项目概览

PaddlePaddle / ERNIE
大约 2 年 前同步成功

通知 115
Star 5997
Fork 1271
  • 代码
    • 文件
    • 提交
    • 分支
    • Tags
    • 贡献者
    • 分支图
    • Diff
  • Issue 29
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 0
  • Wiki 0
    • Wiki
  • 分析
    • 仓库
    • DevOps
  • 项目成员
  • Pages
E
ERNIE
  • 项目概览
    • 项目概览
    • 详情
    • 发布
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
  • Issue 29
    • Issue 29
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 0
    • 合并请求 0
  • Pages
  • 分析
    • 分析
    • 仓库分析
    • DevOps
  • Wiki 0
    • Wiki
  • 成员
    • 成员
  • 收起侧边栏
  • 动态
  • 分支图
  • 创建新Issue
  • 提交
  • Issue看板
已关闭
开放中
Opened 1月 07, 2020 by saxon_zh@saxon_zhGuest

ernie tiny 的finetune_classifier异常

Created by: leyiwang

下载了ernie tiny的config, 启动finetune_classifier时,参照reademe的说明:

1 线上GPU 容器环境下:

ERNIE tiny 模型采用了subword粒度输入,需要在数据前处理中加入切词(segmentation)并使用sentence piece进行tokenization. segmentation 以及 tokenization 需要使用的模型包含在了 ERNIE tiny 的预训练模型文件中,分别是 ./subword/dict.wordseg.pickle 和 ./subword/spm_cased_simp_sampled.model.
目前./example/下的代码针对 ERNIE tiny 的前处理进行了适配只需在脚本中通过 --sentence_piece_model 引入tokenization 模型,再通过 --word_dict 引入 segmentation 模型之后即可进行 ERNIE tiny 的 Fine-tune。

指定了--sentence_piece_model 和--word_dict参数,

# for ernie tiny
python3.6 ernie/finetune_classifier.py \
    --data_dir ${TASK_DATA_PATH}/chnsenticorp/  \
    --warm_start_from ${MODEL_PATH}/params \
    --vocab_file ${MODEL_PATH}/vocab.txt \
    --max_seqlen 128 \
    --sentence_piece_model ${MODEL_PATH}/subword/spm_cased_simp_sampled.model \
    --word_dict ${MODEL_PATH}/subword/dict.wordseg.pickle \
    --run_config '{
        "model_dir": "output",
        "max_steps": '$((10 * 9600 / 32))',
        "save_steps": 100,
        "log_steps": 10,
        "max_ckpt": 1,
        "skip_steps": 0,
        "eval_steps": 100
    }' \
    --hparam ${MODEL_PATH}/ernie_config.json \
    --hparam '{ # model definition
        "sent_type_vocab_size": None,    # default term in official config
        "use_task_id": False,
        "task_id": 0,
        }' \
    --hparam '{ # learn
      "warmup_proportion":  0.1,
      "weight_decay": 0.01,
      "use_fp16": 0,
      "learning_rate": 0.00005,
      "num_label": 2,
      "batch_size": 32
    }'

B8C6E20AF49CF70A3E3D59490

2 本地mac环境下

线上gpu环境下的docker容器里的ernie tiny 的finetune是使用github上的ernie代码,根据readme说明下载了相关的数据、模型文件,修改了启动的python命令,跑的,报https://github.com/PaddlePaddle/ERNIE/issues/397的错误。

因为本地没有gpu,直接跑会报错,我根据错误提示将几处cuda_places替换为cpu_places,发现本地用cpu可以跑通,不再报类型转换的错误。 但是线上gpu环境下的代码和本地差的就是这几处cpu_places的替换,数据、模型一致,却报了类型转换错误。

...
[INFO] 2020-01-08 12:42:39,990 [monitored_executor.py:  230]:	warm start: encoder_layer_2_post_ffn_layer_norm_bias
[INFO] 2020-01-08 12:42:39,990 [monitored_executor.py:  230]:	warm start: pooled_fc.w_0
[INFO] 2020-01-08 12:42:39,990 [monitored_executor.py:  230]:	warm start: pooled_fc.b_0
[DEBUG] 2020-01-08 12:42:41,849 [monitored_executor.py:  281]:	freezing program
[INFO] 2020-01-08 12:42:41,849 [monitored_executor.py:  269]:	replica id 0 of 1
[DEBUG] 2020-01-08 12:42:41,884 [monitored_executor.py:  283]:	done freezing
[INFO] 2020-01-08 12:42:41,884 [monitored_executor.py:  284]:	********** Start Loop ************
[DEBUG] 2020-01-08 12:42:41,884 [monitored_executor.py:  289]:	train loop has hook <propeller.paddle.train.hooks.StopAtStepHook object at 0x12d108cc0>
[DEBUG] 2020-01-08 12:42:41,885 [monitored_executor.py:  289]:	train loop has hook <propeller.paddle.train.hooks.LoggingHook object at 0x12d29c5c0>
[DEBUG] 2020-01-08 12:42:41,885 [monitored_executor.py:  289]:	train loop has hook <propeller.paddle.train.trainer.train_and_eval.<locals>.EvalHookOnTrainLoop object at 0x1391a93c8>
[DEBUG] 2020-01-08 12:42:41,885 [monitored_executor.py:  289]:	train loop has hook <propeller.paddle.train.hooks.CheckpointSaverHook object at 0x12d2d3080>
I0108 12:42:42.160605 3072451456 parallel_executor.cc:421] The number of CPUPlace, which is used in ParallelExecutor, is 1. And the Program will be copied 1 copies
I0108 12:42:42.206982 3072451456 build_strategy.cc:363] SeqOnlyAllReduceOps:0, num_trainers:1
I0108 12:42:42.243758 3072451456 parallel_executor.cc:285] Inplace strategy is enabled, when build_strategy.enable_inplace = True
I0108 12:42:42.325690 3072451456 parallel_executor.cc:315] Cross op memory reuse strategy is enabled, when build_strategy.memory_optimize = True or garbage collection strategy is disabled, which is not recommended
I0108 12:42:42.351922 3072451456 parallel_executor.cc:368] Garbage collection strategy is enabled, when FLAGS_eager_delete_tensor_gb = 0
[DEBUG] 2020-01-08 12:47:09,765 [    hooks.py:  207]:	step: 10	steps/sec: -1.00000	loss: 0.77125	lr:[1.6666667e-06]
[DEBUG] 2020-01-08 12:51:13,554 [    hooks.py:  207]:	step: 20	steps/sec: 0.03969	loss: 0.77323	lr:[3.3333333e-06]
[DEBUG] 2020-01-08 12:56:19,886 [    hooks.py:  207]:	step: 30	steps/sec: 0.03903	loss: 0.71317	lr:[5.e-06]
[INFO] 2020-01-08 12:59:26,841 [monitored_executor.py:  336]:	********** Stop Loop ************
指派人
分配到
无
里程碑
无
分配里程碑
工时统计
无
截止日期
无
标识: paddlepaddle/ERNIE#397
渝ICP备2023009037号

京公网安备11010502055752号

网络110报警服务 Powered by GitLab CE v13.7
开源知识
Git 入门 Pro Git 电子书 在线学 Git
Markdown 基础入门 IT 技术知识开源图谱
帮助
使用手册 反馈建议 博客
《GitCode 隐私声明》 《GitCode 服务条款》 关于GitCode
Powered by GitLab CE v13.7