FlagEmbedding
FlagEmbedding copied to clipboard
Retrieval and Retrieval-augmented LLMs
Currently i cannot really use the "Sparse mode" of BGE-M3. Even with 8 GB VRAM and small batch sizes I get CUDA out of mem. Why does this mode need...
python eval_C-MTEB.py --model_name_or_path ../../bge-large-zh-v1.5 --task_type DuRetrieval ``` Traceback (most recent call last): File "/Users/Downloads/llm-models/FlagEmbedding/C_MTEB/eval_C-MTEB.py", line 4, in from flag_dres_model import FlagDRESModel File "/Users/Downloads/llm-models/FlagEmbedding/C_MTEB/flag_dres_model.py", line 5, in from mteb import DRESModel...
关于性能问题
服务端用bge-small做文本embedding, 任务是短文本匹配,使用gpu推理,单样本(20字符长度文本对)做推理,没有用batch, 平均耗时约20ms。但是接口调用方的请求比较快,每秒钟有20个请求,每个请求有数百条匹配文本,请求数越多,模型的平均推理耗时越长。想问下有没有可以提升模型推理速度的方法?看issue中提到的几个方法 1. embedding降维,用pca或者加一层全连接,把768/512降低到 128维; 2. 转onnx部署 3. 用batch的形式做embedding 4. 使用hugging face的text-embedding-inference 的docker形式部署 方法4应该是比较好的,bge的微调后的FlagModel模型,好像有不能用4的方式部署了?有什么方法解决吗
在把向量保存到milvus后想使用milvus的搜索,这时搜索算法选择什么比较好,milvus提供点积和余弦相似,看示例代码bge用的是点积,但是测试下来点积的结果最高就是0.4附近,请问这样配置正确吗 index_params = { "metric_type": "IP", # 使用点积,欧氏距离L2 "index_type": "IVF_FLAT", # 使用IVF_FLAT索引 "params": {"nlist": 1024} # 索引构建参数,nlist值根据数据量和查询性能要求调整 }
关于微调的问题
你好,想问关于以下几个问题 1. 如果有n个query,n*8个passage,即每个query都有一个正例和七个负例。每个query都会与n*8计算score吗?最后会得到一个(n, 8n)大小的scores矩阵 2. target[i]的含义是第i个query对应的正例index吗? 3. 在计算crossEntropy时,只有正例对loss有贡献,负例相关的loss都为0吗? ```python q_reps = self.encode(query) p_reps = self.encode(passage) if self.training: if self.negatives_cross_device: q_reps = self._dist_gather_tensor(q_reps) p_reps = self._dist_gather_tensor(p_reps) scores = self.compute_similarity(q_reps, p_reps) scores...
在检索增强的过程中,命中的文本较长,在进行rerank时,超过了最大长度,请问有计划发布更大的张量的rerank模型吗?
I noticed lexicial_weights of BGE M3, is a dict of str: float. The key is a string form of index(tokenizer's vocabulary), is there some design reason for this? We can...
Hello, i am trying to use LlamaIndex and FlagEmbedding together but it is really difficult. Could you provide a simple example of it? Is there a possibility to train a...
内存超限问题
您好,我同样的代码,同样的模型,之前都能跑起来,现在31个GPU了还是不行呢? 配置如下: 报错如下: FlagEmbedding版本:从1.0.3试到最高版本; 代码如下: from FlagEmbedding import FlagModel model = FlagModel('/model/bge-large-zh', query_instruction_for_retrieval="为这个句子生成表示以用于检索相关文章:") while True: user_q = input("请输入1>> ") user_a = input("请输入2>> ") embeddings_1 = model.encode(user_q) embeddings_2 = model.encode(user_a) similarity...