Avoid missing packages and attn_mask dtype error #992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I installed the repo for Visualized-BGE following the instructions at
FlagEmbedding/visual/README.md
on CPU. I downloaded the weights from HF. When executing the example code in the README:I got two errors:
1. Missing packages.
peft
andsentencepiece
, the former for BAAI/bge-base-en-v1.5 and the latter for BAAI/bge-m3. I added those tosetup.py
. When pip installing them, all was well. Note: I have no experience withsetup.py
based installations, so best check if this is correct.2. Dtype mismatch: happens when encoding only text, without images.
This is solved by ensuring
extended_attention_mask = extended_attention_mask.to(embedding_output.dtype)
, I added this inmodeling.py:205
. After that, all is well and the 3 numerical values of the similarities at the end of the above code snippet are reproduced.Would be nice if you can merge this so I don't have to rely on my own fork for further work! Cheers