-
Notifications
You must be signed in to change notification settings - Fork 142
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
base: main
Are you sure you want to change the base?
Conversation
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": |
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.
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"): |
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.
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": |
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.
If the strategy gets more complicated, we should make it a Union[str, InstantiableConfig ].
No description provided.