-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add embedding inputs to T5 model #3668
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
Conversation
| test_resize_position_embeddings = False | ||
| test_mismatched_shapes = True | ||
| test_missing_keys = True | ||
| use_test_inputs_embeds = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的 use_test_inputs_embeds 好像在下面的单测中没有用到了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已补上
| inputs["decoder_inputs_embeds"] = wte(decoder_input_ids) | ||
|
|
||
| with paddle.no_grad(): | ||
| model(**inputs)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的测试逻辑是要求他不报错吗?能否加上一个直接用input_ids跑和input_embeds跑的assertEquals?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
接受提议并修改完成
…ut from input_embeds to test_inputs_embeds
| with paddle.no_grad(): | ||
| embeds_output = model(**inputs) | ||
|
|
||
| assert paddle.allclose(ids_output, embeds_output, 1e-4, 1e-4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 这里不能直接用python的assert. 需要用unittest这个class的assert
- 代码风格上,最好把1e-4的的key加上
self.assertTrue(paddle.allclose(ids_output, embeds_output, atol=1e-4))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
PR types
New features
PR changes
Models
Description
test_inputs_embedstotest_modeling_common.py