Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • PaddlePaddle
  • models
  • Issue
  • #3828

M
models
  • 项目概览

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

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

How to run BERT model correctly and interpret results?

Created by: ghost

Hi,

I have a question regarding BERT model. I use the model from this repository and run it with parameters you suggest, I run the pretraining stage, so I use train.py script. I only change batch size and max_seq_len parameters, but config and every other parameter is the same as recommended.

  1. Now my question is - how to interpret the results? For example if I run with batch_size 1024 and I get the following output:
epoch: 4, progress: 1/1, step: 8720, loss: 8.089045, ppl: 1050.821289, next_sent_acc: 0.250000, speed: 5.793753 steps/s, file: demo_wiki_train.gz

does that mean that BERT processed 1024 * 5.79 sentences per second? Or just 5.79 sentences per second? What does this step mean in that context?

  1. Second question - why can't I set batch_size smaller that max_seq_len? I would like to run some tests on batch 8 for example but I cannot do that.
Traceback (most recent call last):
  File "train.py", line 449, in <module>
    train(args)
  File "train.py", line 270, in train
    batch_size=args.batch_size // args.max_seq_len)
  File "/usr/local/lib/python2.7/dist-packages/paddle/fluid/contrib/memory_usage_calc.py", line 75, in memory_usage
    raise ValueError("The batch size need to be positive.")
ValueError: The batch size need to be positive.

I don't understand why this is the case. In other DL frameworks I can run whatever batch I want regardless of max_seq_len.

  1. Last question - why doesn't fp16 speed things up? When I run batch_size=512, max_seq_len=128 with fp32 I get roughly 18-20 steps/s, then when I use --use_fp16=true I get the same numbers. Is this desired behavior? I use NVIDIA V100 16GB. I see now that for larger batch_size it does indeed speed things up a bit and less memory is used.
指派人
分配到
无
里程碑
无
分配里程碑
工时统计
无
截止日期
无
标识: paddlepaddle/models#3828
渝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