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

Adding the interpolation function for PosEmbeddingConverter #139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zbwglory
Copy link
Contributor

No description provided.

return jax.image.resize(
x, (x.shape[0], target_len, x.shape[2]), method="bilinear", antialias=False
)
elif cfg.strategy == "interpolate_with_cls_token_removed":
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an else to raise a NotImplementedError?

@@ -912,7 +912,27 @@ def replace_prefix(source_weight, target_weight):
)(source_weight, target_weight)
elif cfg.strategy == "keep_target":
out["pos_emb"] = target["pos_emb"]
# TODO(xianzhi): Implement interpolation for shape matching.
elif cfg.strategy.startswith("interpolate"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Update the comments on strategy in Config definition above?

return jax.image.resize(
x, (x.shape[0], target_len, x.shape[2]), method="bilinear", antialias=False
)
elif cfg.strategy == "interpolate_with_cls_token_removed":
Copy link
Contributor

Choose a reason for hiding this comment

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

If the strategy gets more complicated, we should make it a Union[str, InstantiableConfig ].

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.

None yet

2 participants