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

关于约束解码的一个问题 #6

Closed
hlee-top opened this issue Aug 9, 2022 · 2 comments
Closed

关于约束解码的一个问题 #6

hlee-top opened this issue Aug 9, 2022 · 2 comments

Comments

@hlee-top
Copy link

hlee-top commented Aug 9, 2022

作者您好,关于约束解码我有一个问题,请问constraint_decoder为什么只在下面代码条件下使用,希望作者能够解答我的疑问,谢谢!

if not self.args.predict_with_generate or prediction_loss_only:
return super().prediction_step(
model=model,
inputs=inputs,
prediction_loss_only=prediction_loss_only,
ignore_keys=ignore_keys,
prefix_allowed_tokens_fn=prefix_allowed_tokens_fn if self.constraint_decoder else None,
)

@boy56
Copy link
Collaborator

boy56 commented Aug 10, 2022

作者您好,关于约束解码我有一个问题,请问constraint_decoder为什么只在下面代码条件下使用,希望作者能够解答我的疑问,谢谢!

if not self.args.predict_with_generate or prediction_loss_only:
return super().prediction_step(
model=model,
inputs=inputs,
prediction_loss_only=prediction_loss_only,
ignore_keys=ignore_keys,
prefix_allowed_tokens_fn=prefix_allowed_tokens_fn if self.constraint_decoder else None,
)

这个就是在预测生成的时候使用一个约束解码,训练过程中是不参与的。

@hlee-top
Copy link
Author

感谢您的回答

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