-
Notifications
You must be signed in to change notification settings - Fork 564
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
feat: Integration of VLM embedding model #446
base: master
Are you sure you want to change the base?
Conversation
@FUYICC Hi, is the pr still in progress? Let me know if you have any difficulties. |
Thank you for your kind help! Sorry I've been mostly working on my dissertation for the past 3 weeks so I haven't had time to move forward, I'll be up and running starting next week, we'll discuss any questions anytime! |
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.
Thanks for the contribution and sorry for the late review, left some comments
camel/embeddings/vlm_embedding.py
Outdated
images=obj, return_tensors="pt", padding=True, **kwargs | ||
) | ||
image_feature = ( | ||
self.model.get_image_features(**input, **kwargs) |
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.
redundant kwargs could lead to unexpected behaviors if kwargs contains overlapping keys
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.
how about separate kwargs into 2 dict?
def embed_list(
self,
objs: List[Union[Image.Image, str]],
processor_kwargs: dict ={},
model_kwargs: dict = {},
) -> List[List[float]]:
text_input = self.processor(
text=obj,
return_tensors="pt",
padding=True,
**processor_kwargs,
)
text_feature = (
self.model.get_text_features(**text_input, **model_kwargs)
.squeeze(dim=0)
.tolist()
)
camel/embeddings/vlm_embedding.py
Outdated
text=obj, return_tensors="pt", padding=True, **kwargs | ||
) | ||
text_feature = ( | ||
self.model.get_text_features(**input, **kwargs) |
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.
same as above
@@ -59,7 +59,7 @@ pyowm = { version = "^3.3.0", optional = true } | |||
googlemaps = { version = "^4.10.0", optional = true } | |||
requests_oauthlib = { version = "^1.3.1", optional = true } | |||
unstructured = { extras = ["all-docs"], version = "^0.10.30", optional = true } | |||
|
|||
pillow = { version = "^10.2.0", optional = true } |
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.
why we need this library?
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.
Because we need to determine if the input is an image or not in vlm embedding class.
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.
also add it under [tool.poetry.extras] tools and all part, as well as [[tool.mypy.overrides]]
Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
Description
Issue #445
Summary by CodeRabbit
CLIPEmbedding
for image and text embedding functionalities.CLIPEmbedding
functionality, covering initialization, embedding processes, and output dimension retrieval.