flashrag-dev 0.1.4.dev20250322__tar.gz → 0.1.4.dev20250326__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/PKG-INFO +1 -1
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/retriever.py +39 -17
- flashrag_dev-0.1.4.dev20250326/flashrag/version.py +1 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag_dev.egg-info/PKG-INFO +1 -1
- flashrag_dev-0.1.4.dev20250322/flashrag/version.py +0 -1
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/LICENSE +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/README.md +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/config/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/config/basic_config.yaml +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/config/config.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/dataset/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/dataset/dataset.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/dataset/utils.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/_bleu.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/evaluator.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/metrics.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/utils.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/fid.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/generator.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/multimodal_generator.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/openai_generator.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/stop_word_criteria.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/utils.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/judger/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/judger/judger.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/active_pipeline.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/branching_pipeline.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/mm_pipeline.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/pipeline.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/reasoning_pipeline.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/replug_utils.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/base_prompt.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/mm_prompt.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/selfask_examplars.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/trace_examplars.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/refiner/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/refiner/kg_refiner.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/refiner/llmlingua_compressor.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/refiner/refiner.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/refiner/selective_context_compressor.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/__main__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/encoder.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/index_builder.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/reranker.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/utils.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/utils/__init__.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/utils/constants.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/utils/pred_parse.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/utils/utils.py +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag_dev.egg-info/SOURCES.txt +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag_dev.egg-info/dependency_links.txt +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag_dev.egg-info/requires.txt +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag_dev.egg-info/top_level.txt +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/pyproject.toml +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/setup.cfg +0 -0
- {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: flashrag_dev
|
|
3
|
-
Version: 0.1.4.
|
|
3
|
+
Version: 0.1.4.dev20250326
|
|
4
4
|
Summary: A library for efficient Retrieval-Augmented Generation research
|
|
5
5
|
Home-page: https://github.com/RUC-NLPIR/FlashRAG
|
|
6
6
|
Author: Jiajie Jin, Yutao Zhu, Chenghao Zhang, Xinyu Yang, Zhicheng Dou
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/retriever.py
RENAMED
|
@@ -156,6 +156,7 @@ class BaseRetriever:
|
|
|
156
156
|
with open(self.cache_path, "r") as f:
|
|
157
157
|
self.cache = json.load(f)
|
|
158
158
|
self.silent = self._config["silent_retrieval"] if "silent_retrieval" in self._config else False
|
|
159
|
+
|
|
159
160
|
def update_additional_setting(self):
|
|
160
161
|
pass
|
|
161
162
|
|
|
@@ -370,31 +371,54 @@ class DenseRetriever(BaseTextRetriever):
|
|
|
370
371
|
self.batch_size = self._config["retrieval_batch_size"]
|
|
371
372
|
self.instruction = self._config["instruction"]
|
|
372
373
|
|
|
373
|
-
self.
|
|
374
|
+
self.retrieval_model_path = self._config["retrieval_model_path"]
|
|
374
375
|
self.use_st = self._config["use_sentence_transformer"]
|
|
375
376
|
self.use_faiss_gpu = self._config["faiss_gpu"]
|
|
376
377
|
|
|
377
378
|
def load_model(self):
|
|
378
379
|
if self.use_st:
|
|
379
380
|
self.encoder = STEncoder(
|
|
380
|
-
model_name
|
|
381
|
-
model_path
|
|
382
|
-
max_length
|
|
383
|
-
use_fp16
|
|
384
|
-
instruction
|
|
385
|
-
silent
|
|
381
|
+
model_name=self.retrieval_method,
|
|
382
|
+
model_path=self._config["retrieval_model_path"],
|
|
383
|
+
max_length=self.query_max_length,
|
|
384
|
+
use_fp16=self.use_fp16,
|
|
385
|
+
instruction=self.instruction,
|
|
386
|
+
silent=self.silent,
|
|
386
387
|
)
|
|
387
388
|
else:
|
|
388
389
|
# check pooling method
|
|
389
390
|
self._check_pooling_method(self.retrieval_model_path, self.pooling_method)
|
|
390
391
|
self.encoder = Encoder(
|
|
391
|
-
model_name
|
|
392
|
-
model_path
|
|
393
|
-
pooling_method
|
|
394
|
-
max_length
|
|
395
|
-
use_fp16
|
|
396
|
-
instruction
|
|
397
|
-
|
|
392
|
+
model_name=self.retrieval_method,
|
|
393
|
+
model_path=self.retrieval_model_path,
|
|
394
|
+
pooling_method=self.pooling_method,
|
|
395
|
+
max_length=self.query_max_length,
|
|
396
|
+
use_fp16=self.use_fp16,
|
|
397
|
+
instruction=self.instruction,
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
def _check_pooling_method(self, model_path, pooling_method):
|
|
401
|
+
try:
|
|
402
|
+
# read pooling method from 1_Pooling/config.json
|
|
403
|
+
pooling_config = json.load(open(os.path.join(model_path, "1_Pooling/config.json")))
|
|
404
|
+
for k, v in pooling_config.items():
|
|
405
|
+
if k.startswith("pooling_mode") and v == True:
|
|
406
|
+
detect_pooling_method = k.split("pooling_mode_")[-1]
|
|
407
|
+
if detect_pooling_method == "mean_tokens":
|
|
408
|
+
detect_pooling_method = "mean"
|
|
409
|
+
elif detect_pooling_method == "cls_token":
|
|
410
|
+
detect_pooling_method = "cls"
|
|
411
|
+
else:
|
|
412
|
+
# raise warning: not implemented pooling method
|
|
413
|
+
warnings.warn(f"Pooling method {detect_pooling_method} is not implemented.", UserWarning)
|
|
414
|
+
detect_pooling_method = "mean"
|
|
415
|
+
break
|
|
416
|
+
except:
|
|
417
|
+
detect_pooling_method = None
|
|
418
|
+
|
|
419
|
+
if detect_pooling_method is not None and detect_pooling_method != pooling_method:
|
|
420
|
+
warnings.warn(
|
|
421
|
+
f"Pooling method in model config file is {detect_pooling_method}, but the input is {pooling_method}. Please check carefully."
|
|
398
422
|
)
|
|
399
423
|
|
|
400
424
|
def _search(self, query: str, num: int = None, return_score=False):
|
|
@@ -462,9 +486,7 @@ class MultiModalRetriever(BaseRetriever):
|
|
|
462
486
|
self.batch_size = config["retrieval_batch_size"]
|
|
463
487
|
|
|
464
488
|
self.encoder = ClipEncoder(
|
|
465
|
-
model_name=self.retrieval_method,
|
|
466
|
-
model_path=config["retrieval_model_path"],
|
|
467
|
-
silent=self.silent
|
|
489
|
+
model_name=self.retrieval_method, model_path=config["retrieval_model_path"], silent=self.silent
|
|
468
490
|
)
|
|
469
491
|
|
|
470
492
|
def _judge_input_modal(self, query):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.4dev20250326"
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag_dev.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: flashrag-dev
|
|
3
|
-
Version: 0.1.4.
|
|
3
|
+
Version: 0.1.4.dev20250326
|
|
4
4
|
Summary: A library for efficient Retrieval-Augmented Generation research
|
|
5
5
|
Home-page: https://github.com/RUC-NLPIR/FlashRAG
|
|
6
6
|
Author: Jiajie Jin, Yutao Zhu, Chenghao Zhang, Xinyu Yang, Zhicheng Dou
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.4dev20250322"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/config/__init__.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/config/basic_config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/dataset/__init__.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/dataset/dataset.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/__init__.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/_bleu.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/evaluator.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/metrics.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/evaluator/utils.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/generator/utils.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/judger/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/mm_pipeline.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/pipeline.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/pipeline/replug_utils.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/__init__.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/base_prompt.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/mm_prompt.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/prompt/trace_examplars.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/refiner/__init__.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/refiner/kg_refiner.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/refiner/refiner.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/__init__.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/__main__.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/encoder.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/reranker.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/retriever/utils.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/utils/__init__.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/utils/constants.py
RENAMED
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag/utils/pred_parse.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag_dev.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250326}/flashrag_dev.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|