Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argparse中参数gradient_accumulation类型错误 #38

Closed
xinfeng1i opened this issue Aug 27, 2019 · 3 comments
Closed

argparse中参数gradient_accumulation类型错误 #38

xinfeng1i opened this issue Aug 27, 2019 · 3 comments

Comments

@xinfeng1i
Copy link

错误原因
train.py 脚本中第 57 行 parser 设置参数 gradient_accumulation 的类型为 str

parser.add_argument('--gradient_accumulation', default=1, type=str, required=False, help='梯度积累')

会导致第 139 进行除运算时抛出类型错误,不能对 str 做除法

total_steps = int(full_len / stride * epochs / batch_size / gradient_accumulation)

更正建议
在第 57 行设置参数 gradient_accumulation 的类型为 int

@Morizeyao
Copy link
Owner

感谢提议,这个问题是你发现的,可以你做个PR,我merge进来,这样你可以成为contributer。

@Morizeyao
Copy link
Owner

已修正

@xinfeng1i
Copy link
Author

看到晚了,你已经更正了。下次有机会我再成为 contributor 吧,哈哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants