FlagEmbedding
FlagEmbedding copied to clipboard
ModuleNotFoundError: No module named 'visual_bge'
Hi, there is an error of importing packages in my code. I did all the steps included:
git clone https://github.com/FlagOpen/FlagEmbedding.git
cd FlagEmbedding/research/visual_bge
pip install -e .
and
pip install torchvision timm einops ftfy
And then I used the demo code in the README file
####### Use Visualized BGE doing composed image retrieval
import torch
from visual_bge.modeling import Visualized_BGE
model = Visualized_BGE(model_name_bge = "BAAI/bge-base-en-v1.5", model_weight="path: Visualized_base_en_v1.5.pth")
model.eval()
with torch.no_grad():
query_emb = model.encode(image="./imgs/cir_query.png", text="Make the background dark, as if the camera has taken the photo at night")
candi_emb_1 = model.encode(image="./imgs/cir_candi_1.png")
candi_emb_2 = model.encode(image="./imgs/cir_candi_2.png")
sim_1 = query_emb @ candi_emb_1.T
sim_2 = query_emb @ candi_emb_2.T
print(sim_1, sim_2) # tensor([[0.8750]]) tensor([[0.7816]])
But it always gave me the error message:
from visual_bge.modeling import Visualized_BGE
ModuleNotFoundError: No module named 'visual_bge'