flashrag-dev 0.1.3.dev20241112__tar.gz → 0.1.3.dev20241117__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 (58) hide show
  1. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/PKG-INFO +6 -1
  2. flashrag-dev-0.1.3.dev20241112/flashrag_dev.egg-info/PKG-INFO → flashrag-dev-0.1.3.dev20241117/README.md +5 -16
  3. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/pipeline.py +1 -4
  4. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/utils.py +19 -2
  5. flashrag-dev-0.1.3.dev20241117/flashrag/version.py +1 -0
  6. flashrag-dev-0.1.3.dev20241112/README.md → flashrag-dev-0.1.3.dev20241117/flashrag_dev.egg-info/PKG-INFO +21 -0
  7. flashrag-dev-0.1.3.dev20241112/flashrag/version.py +0 -1
  8. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/LICENSE +0 -0
  9. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/__init__.py +0 -0
  10. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/config/__init__.py +0 -0
  11. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/config/basic_config.yaml +0 -0
  12. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/config/config.py +0 -0
  13. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/dataset/__init__.py +0 -0
  14. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/dataset/dataset.py +0 -0
  15. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/dataset/utils.py +0 -0
  16. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/__init__.py +0 -0
  17. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/_bleu.py +0 -0
  18. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/evaluator.py +0 -0
  19. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/metrics.py +0 -0
  20. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/utils.py +0 -0
  21. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/__init__.py +0 -0
  22. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/fid.py +0 -0
  23. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/generator.py +0 -0
  24. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/openai_generator.py +0 -0
  25. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/stop_word_criteria.py +0 -0
  26. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/utils.py +0 -0
  27. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/judger/__init__.py +0 -0
  28. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/judger/judger.py +0 -0
  29. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/__init__.py +0 -0
  30. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/active_pipeline.py +0 -0
  31. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/branching_pipeline.py +0 -0
  32. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/replug_utils.py +0 -0
  33. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/__init__.py +0 -0
  34. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/base_prompt.py +0 -0
  35. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/selfask_examplars.py +0 -0
  36. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/trace_examplars.py +0 -0
  37. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/__init__.py +0 -0
  38. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/kg_refiner.py +0 -0
  39. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/llmlingua_compressor.py +0 -0
  40. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/refiner.py +0 -0
  41. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/selective_context_compressor.py +0 -0
  42. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/__init__.py +0 -0
  43. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/__main__.py +0 -0
  44. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/encoder.py +0 -0
  45. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/index_builder.py +0 -0
  46. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/reranker.py +0 -0
  47. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/retriever.py +0 -0
  48. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/__init__.py +0 -0
  49. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/constants.py +0 -0
  50. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/pred_parse.py +0 -0
  51. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/utils.py +0 -0
  52. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/SOURCES.txt +0 -0
  53. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/dependency_links.txt +0 -0
  54. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/requires.txt +0 -0
  55. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/top_level.txt +0 -0
  56. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/pyproject.toml +0 -0
  57. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/setup.cfg +0 -0
  58. {flashrag-dev-0.1.3.dev20241112 → flashrag-dev-0.1.3.dev20241117}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flashrag-dev
3
- Version: 0.1.3.dev20241112
3
+ Version: 0.1.3.dev20241117
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
@@ -536,6 +536,11 @@ In the academic research, Wikipedia and MS MARCO are the most commonly used retr
536
536
 
537
537
  For MS MARCO, it is already processed upon release and can be directly downloaded from its [<u>hosting link</u>](https://huggingface.co/datasets/Tevatron/msmarco-passage-corpus) on Hugging Face.
538
538
 
539
+ ### Index
540
+
541
+ To facilitate easier replication of the experiments, we now provide a preprocessed index available in the ModelScope dataset page: [FlashRAG_Dataset/retrieval_corpus/wiki18_100w_e5_index.zip](https://www.modelscope.cn/datasets/hhjinjiajie/FlashRAG_Dataset/file/view/master?id=47985&status=2&fileName=retrieval_corpus%252Fwiki18_100w_e5_index.zip).
542
+
543
+ The index was created using the e5-base-v2 retriever on our uploaded wiki18_100w dataset, which is consistent with the index used in our experiments.
539
544
 
540
545
  ## :raised_hands: Additional FAQs
541
546
 
@@ -1,19 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: flashrag-dev
3
- Version: 0.1.3.dev20241112
4
- Summary: A library for efficient Retrieval-Augmented Generation research
5
- Home-page: https://github.com/RUC-NLPIR/FlashRAG
6
- Author: Jiajie Jin, Yutao Zhu, Chenghao Zhang, Xinyu Yang, Zhicheng Dou
7
- Author-email: jinjiajie@ruc.edu.cn
8
- License: MIT License
9
- Requires-Python: >=3.9
10
- Description-Content-Type: text/markdown
11
- Provides-Extra: core
12
- Provides-Extra: retriever
13
- Provides-Extra: generator
14
- Provides-Extra: full
15
- License-File: LICENSE
16
-
17
1
  # <div align="center">⚡FlashRAG: A Python Toolkit for Efficient RAG Research<div>
18
2
 
19
3
 
@@ -536,6 +520,11 @@ In the academic research, Wikipedia and MS MARCO are the most commonly used retr
536
520
 
537
521
  For MS MARCO, it is already processed upon release and can be directly downloaded from its [<u>hosting link</u>](https://huggingface.co/datasets/Tevatron/msmarco-passage-corpus) on Hugging Face.
538
522
 
523
+ ### Index
524
+
525
+ To facilitate easier replication of the experiments, we now provide a preprocessed index available in the ModelScope dataset page: [FlashRAG_Dataset/retrieval_corpus/wiki18_100w_e5_index.zip](https://www.modelscope.cn/datasets/hhjinjiajie/FlashRAG_Dataset/file/view/master?id=47985&status=2&fileName=retrieval_corpus%252Fwiki18_100w_e5_index.zip).
526
+
527
+ The index was created using the e5-base-v2 retriever on our uploaded wiki18_100w dataset, which is consistent with the index used in our experiments.
539
528
 
540
529
  ## :raised_hands: Additional FAQs
541
530
 
@@ -216,10 +216,7 @@ class AdaptivePipeline(BasicPipeline):
216
216
  )
217
217
 
218
218
  self.multi_hop_pipeline = IRCOTPipeline(
219
- config,
220
- prompt_template=multi_hop_prompt_template,
221
- retriever=retriever,
222
- generator=generator,
219
+ config, prompt_template=multi_hop_prompt_template, retriever=retriever, generator=generator, max_iter=5
223
220
  )
224
221
 
225
222
  def run(self, dataset, do_eval=True, pred_process_fun=None):
@@ -27,6 +27,7 @@ def pooling(pooler_output, last_hidden_state, attention_mask=None, pooling_metho
27
27
  else:
28
28
  raise NotImplementedError("Pooling method not implemented!")
29
29
 
30
+
30
31
  def set_default_instruction(model_name, is_query=True, is_zh=False):
31
32
  instruction = ""
32
33
  if "e5" in model_name.lower():
@@ -37,7 +38,7 @@ def set_default_instruction(model_name, is_query=True, is_zh=False):
37
38
 
38
39
  if "bge" in model_name.lower():
39
40
  if is_query:
40
- if 'zh' in model_name.lower() or is_zh:
41
+ if "zh" in model_name.lower() or is_zh:
41
42
  instruction = "为这个句子生成表示以用于检索相关文章:"
42
43
  else:
43
44
  instruction = "Represent this sentence for searching relevant passages: "
@@ -60,6 +61,8 @@ def parse_query(model_name, query_list, instruction=None):
60
61
  zh_char += 1
61
62
  except:
62
63
  continue
64
+ if len(str) == 0:
65
+ return False
63
66
  if zh_char / len(str) > 0.2:
64
67
  return True
65
68
  else:
@@ -67,7 +70,7 @@ def parse_query(model_name, query_list, instruction=None):
67
70
 
68
71
  if isinstance(query_list, str):
69
72
  query_list = [query_list]
70
-
73
+
71
74
  if instruction is not None:
72
75
  instruction = instruction.strip() + " "
73
76
  else:
@@ -78,6 +81,7 @@ def parse_query(model_name, query_list, instruction=None):
78
81
 
79
82
  return query_list
80
83
 
84
+
81
85
  def load_corpus(corpus_path: str):
82
86
  corpus = datasets.load_dataset("json", data_files=corpus_path, split="train")
83
87
  return corpus
@@ -98,3 +102,16 @@ def load_docs(corpus, doc_idxs):
98
102
  results = [corpus[int(idx)] for idx in doc_idxs]
99
103
 
100
104
  return results
105
+
106
+
107
+ def parse_image(image):
108
+ from PIL import Image
109
+
110
+ if isinstance(image, str):
111
+ if image.startswith("http"):
112
+ import requests
113
+
114
+ image = Image.open(requests.get(image, stream=True).raw)
115
+ else:
116
+ image = Image.open(image)
117
+ return image
@@ -0,0 +1 @@
1
+ __version__ = "0.1.3dev20241117"
@@ -1,3 +1,19 @@
1
+ Metadata-Version: 2.1
2
+ Name: flashrag-dev
3
+ Version: 0.1.3.dev20241117
4
+ Summary: A library for efficient Retrieval-Augmented Generation research
5
+ Home-page: https://github.com/RUC-NLPIR/FlashRAG
6
+ Author: Jiajie Jin, Yutao Zhu, Chenghao Zhang, Xinyu Yang, Zhicheng Dou
7
+ Author-email: jinjiajie@ruc.edu.cn
8
+ License: MIT License
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ Provides-Extra: core
12
+ Provides-Extra: retriever
13
+ Provides-Extra: generator
14
+ Provides-Extra: full
15
+ License-File: LICENSE
16
+
1
17
  # <div align="center">⚡FlashRAG: A Python Toolkit for Efficient RAG Research<div>
2
18
 
3
19
 
@@ -520,6 +536,11 @@ In the academic research, Wikipedia and MS MARCO are the most commonly used retr
520
536
 
521
537
  For MS MARCO, it is already processed upon release and can be directly downloaded from its [<u>hosting link</u>](https://huggingface.co/datasets/Tevatron/msmarco-passage-corpus) on Hugging Face.
522
538
 
539
+ ### Index
540
+
541
+ To facilitate easier replication of the experiments, we now provide a preprocessed index available in the ModelScope dataset page: [FlashRAG_Dataset/retrieval_corpus/wiki18_100w_e5_index.zip](https://www.modelscope.cn/datasets/hhjinjiajie/FlashRAG_Dataset/file/view/master?id=47985&status=2&fileName=retrieval_corpus%252Fwiki18_100w_e5_index.zip).
542
+
543
+ The index was created using the e5-base-v2 retriever on our uploaded wiki18_100w dataset, which is consistent with the index used in our experiments.
523
544
 
524
545
  ## :raised_hands: Additional FAQs
525
546
 
@@ -1 +0,0 @@
1
- __version__ = "0.1.3dev20241112"