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

Support resize_position_embeddings for layoutlm-models #2513

Merged
merged 6 commits into from
Jun 24, 2022

Conversation

yingyibiao
Copy link
Contributor

PR types

PR changes

Models

Description

Support resize_position_embeddings for layoutlm-models

Copy link
Contributor

@guoshengCS guoshengCS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以参考HF基类先加上NotImplemented的resize_position_embeddings的接口

self.config["max_position_embeddings"] = new_num_position_embeddings

old_position_embeddings_weight = self.embeddings.position_embeddings.weight.clone(
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否一定要clone呢,不clone是否也行

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不 clone 也可以,已删除 clone 操作。

self.config["max_position_embeddings"] = new_num_position_embeddings

old_position_embeddings_weight = self.embeddings.position_embeddings.weight.clone(
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否一定要clone呢,不clone是否也行

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不 clone 也可以,已删除 clone 操作。

@yingyibiao
Copy link
Contributor Author

可以参考HF基类先加上NotImplemented的resize_position_embeddings的接口

Done

@yingyibiao yingyibiao requested a review from guoshengCS June 22, 2022 04:09
Copy link
Contributor

@guoshengCS guoshengCS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yingyibiao yingyibiao merged commit c92810b into PaddlePaddle:develop Jun 24, 2022
@yingyibiao yingyibiao deleted the position branch June 24, 2022 08:44
@ZHUI ZHUI mentioned this pull request Jun 27, 2022
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

Successfully merging this pull request may close these issues.

3 participants