flashrag-dev 0.1.4.dev20250322__tar.gz → 0.1.4.dev20250403__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.
Files changed (62) hide show
  1. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/PKG-INFO +1 -3
  2. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/README.md +0 -2
  3. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/retriever/retriever.py +39 -17
  4. flashrag_dev-0.1.4.dev20250403/flashrag/version.py +1 -0
  5. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag_dev.egg-info/PKG-INFO +1 -3
  6. flashrag_dev-0.1.4.dev20250322/flashrag/version.py +0 -1
  7. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/LICENSE +0 -0
  8. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/__init__.py +0 -0
  9. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/config/__init__.py +0 -0
  10. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/config/basic_config.yaml +0 -0
  11. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/config/config.py +0 -0
  12. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/dataset/__init__.py +0 -0
  13. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/dataset/dataset.py +0 -0
  14. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/dataset/utils.py +0 -0
  15. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/evaluator/__init__.py +0 -0
  16. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/evaluator/_bleu.py +0 -0
  17. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/evaluator/evaluator.py +0 -0
  18. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/evaluator/metrics.py +0 -0
  19. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/evaluator/utils.py +0 -0
  20. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/generator/__init__.py +0 -0
  21. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/generator/fid.py +0 -0
  22. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/generator/generator.py +0 -0
  23. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/generator/multimodal_generator.py +0 -0
  24. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/generator/openai_generator.py +0 -0
  25. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/generator/stop_word_criteria.py +0 -0
  26. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/generator/utils.py +0 -0
  27. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/judger/__init__.py +0 -0
  28. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/judger/judger.py +0 -0
  29. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/pipeline/__init__.py +0 -0
  30. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/pipeline/active_pipeline.py +0 -0
  31. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/pipeline/branching_pipeline.py +0 -0
  32. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/pipeline/mm_pipeline.py +0 -0
  33. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/pipeline/pipeline.py +0 -0
  34. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/pipeline/reasoning_pipeline.py +0 -0
  35. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/pipeline/replug_utils.py +0 -0
  36. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/prompt/__init__.py +0 -0
  37. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/prompt/base_prompt.py +0 -0
  38. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/prompt/mm_prompt.py +0 -0
  39. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/prompt/selfask_examplars.py +0 -0
  40. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/prompt/trace_examplars.py +0 -0
  41. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/refiner/__init__.py +0 -0
  42. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/refiner/kg_refiner.py +0 -0
  43. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/refiner/llmlingua_compressor.py +0 -0
  44. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/refiner/refiner.py +0 -0
  45. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/refiner/selective_context_compressor.py +0 -0
  46. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/retriever/__init__.py +0 -0
  47. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/retriever/__main__.py +0 -0
  48. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/retriever/encoder.py +0 -0
  49. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/retriever/index_builder.py +0 -0
  50. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/retriever/reranker.py +0 -0
  51. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/retriever/utils.py +0 -0
  52. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/utils/__init__.py +0 -0
  53. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/utils/constants.py +0 -0
  54. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/utils/pred_parse.py +0 -0
  55. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag/utils/utils.py +0 -0
  56. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag_dev.egg-info/SOURCES.txt +0 -0
  57. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag_dev.egg-info/dependency_links.txt +0 -0
  58. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag_dev.egg-info/requires.txt +0 -0
  59. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/flashrag_dev.egg-info/top_level.txt +0 -0
  60. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/pyproject.toml +0 -0
  61. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/setup.cfg +0 -0
  62. {flashrag_dev-0.1.4.dev20250322 → flashrag_dev-0.1.4.dev20250403}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flashrag_dev
3
- Version: 0.1.4.dev20250322
3
+ Version: 0.1.4.dev20250403
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
@@ -108,8 +108,6 @@ FlashRAG is still under development and there are many issues and room for impro
108
108
 
109
109
  [25/01/07] We have currently support the aggregation of multiple retrievers, see it in [**multi retriever usage**](https://github.com/RUC-NLPIR/FlashRAG/blob/main/docs/original_docs/multi_retriever_usage.md).
110
110
 
111
- [25/01/07] We have integrated a very flexible and lightweight corpus chunking library [**Chunkie**](https://github.com/chonkie-ai/chonkie?tab=readme-ov-file#usage), which supports various custom chunking methods (tokens, sentences, semantic, etc.). Use it in [<u>chunking doc corpus</u>](docs/original_docs/chunk-doc-corpus.md).
112
-
113
111
  [24/10/21] We have released a version based on the Paddle framework that supports Chinese hardware platforms. Please refer to [FlashRAG Paddle](https://github.com/RUC-NLPIR/FlashRAG-Paddle) for details.
114
112
 
115
113
  [24/10/13] A new in-domain dataset and corpus - [DomainRAG](https://arxiv.org/pdf/2406.05654) have been added to the dataset. The dataset is based on the internal enrollment data of Renmin University of China, covering seven types of tasks, which can be used for conducting domain-specific RAG testing.
@@ -91,8 +91,6 @@ FlashRAG is still under development and there are many issues and room for impro
91
91
 
92
92
  [25/01/07] We have currently support the aggregation of multiple retrievers, see it in [**multi retriever usage**](https://github.com/RUC-NLPIR/FlashRAG/blob/main/docs/original_docs/multi_retriever_usage.md).
93
93
 
94
- [25/01/07] We have integrated a very flexible and lightweight corpus chunking library [**Chunkie**](https://github.com/chonkie-ai/chonkie?tab=readme-ov-file#usage), which supports various custom chunking methods (tokens, sentences, semantic, etc.). Use it in [<u>chunking doc corpus</u>](docs/original_docs/chunk-doc-corpus.md).
95
-
96
94
  [24/10/21] We have released a version based on the Paddle framework that supports Chinese hardware platforms. Please refer to [FlashRAG Paddle](https://github.com/RUC-NLPIR/FlashRAG-Paddle) for details.
97
95
 
98
96
  [24/10/13] A new in-domain dataset and corpus - [DomainRAG](https://arxiv.org/pdf/2406.05654) have been added to the dataset. The dataset is based on the internal enrollment data of Renmin University of China, covering seven types of tasks, which can be used for conducting domain-specific RAG testing.
@@ -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.retreival_model_path = self._config["retrieval_model_path"]
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 = self.retrieval_method,
381
- model_path = self._config["retrieval_model_path"],
382
- max_length = self.query_max_length,
383
- use_fp16 = self.use_fp16,
384
- instruction = self.instruction,
385
- silent = self.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 = self.retrieval_method,
392
- model_path = self.retreival_model_path,
393
- pooling_method = self.pooling_method,
394
- max_length = self.query_max_length,
395
- use_fp16 = self.use_fp16,
396
- instruction = self.instruction,
397
- silent = self.silent
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.4dev20250403"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flashrag-dev
3
- Version: 0.1.4.dev20250322
3
+ Version: 0.1.4.dev20250403
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
@@ -108,8 +108,6 @@ FlashRAG is still under development and there are many issues and room for impro
108
108
 
109
109
  [25/01/07] We have currently support the aggregation of multiple retrievers, see it in [**multi retriever usage**](https://github.com/RUC-NLPIR/FlashRAG/blob/main/docs/original_docs/multi_retriever_usage.md).
110
110
 
111
- [25/01/07] We have integrated a very flexible and lightweight corpus chunking library [**Chunkie**](https://github.com/chonkie-ai/chonkie?tab=readme-ov-file#usage), which supports various custom chunking methods (tokens, sentences, semantic, etc.). Use it in [<u>chunking doc corpus</u>](docs/original_docs/chunk-doc-corpus.md).
112
-
113
111
  [24/10/21] We have released a version based on the Paddle framework that supports Chinese hardware platforms. Please refer to [FlashRAG Paddle](https://github.com/RUC-NLPIR/FlashRAG-Paddle) for details.
114
112
 
115
113
  [24/10/13] A new in-domain dataset and corpus - [DomainRAG](https://arxiv.org/pdf/2406.05654) have been added to the dataset. The dataset is based on the internal enrollment data of Renmin University of China, covering seven types of tasks, which can be used for conducting domain-specific RAG testing.
@@ -1 +0,0 @@
1
- __version__ = "0.1.4dev20250322"