flashrag-dev 0.1.3.dev20241115__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.
- {flashrag-dev-0.1.3.dev20241115/flashrag_dev.egg-info → flashrag-dev-0.1.3.dev20241117}/PKG-INFO +1 -1
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/pipeline.py +1 -4
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/utils.py +19 -2
- flashrag-dev-0.1.3.dev20241117/flashrag/version.py +1 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117/flashrag_dev.egg-info}/PKG-INFO +1 -1
- flashrag-dev-0.1.3.dev20241115/flashrag/version.py +0 -1
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/LICENSE +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/README.md +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/config/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/config/basic_config.yaml +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/config/config.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/dataset/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/dataset/dataset.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/dataset/utils.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/_bleu.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/evaluator.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/metrics.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/utils.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/fid.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/generator.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/openai_generator.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/stop_word_criteria.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/utils.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/judger/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/judger/judger.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/active_pipeline.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/branching_pipeline.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/replug_utils.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/base_prompt.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/selfask_examplars.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/trace_examplars.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/kg_refiner.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/llmlingua_compressor.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/refiner.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/selective_context_compressor.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/__main__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/encoder.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/index_builder.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/reranker.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/retriever.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/__init__.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/constants.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/pred_parse.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/utils.py +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/SOURCES.txt +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/dependency_links.txt +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/requires.txt +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/top_level.txt +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/pyproject.toml +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/setup.cfg +0 -0
- {flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/setup.py +0 -0
{flashrag-dev-0.1.3.dev20241115/flashrag_dev.egg-info → flashrag-dev-0.1.3.dev20241117}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: flashrag-dev
|
|
3
|
-
Version: 0.1.3.
|
|
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
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/pipeline.py
RENAMED
|
@@ -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):
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/utils.py
RENAMED
|
@@ -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
|
|
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"
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117/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.3.
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.3dev20241115"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/config/__init__.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/config/basic_config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/dataset/__init__.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/dataset/dataset.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/__init__.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/_bleu.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/evaluator.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/metrics.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/evaluator/utils.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/generator/utils.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/judger/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/pipeline/replug_utils.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/__init__.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/base_prompt.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/prompt/trace_examplars.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/__init__.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/kg_refiner.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/refiner/refiner.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/__init__.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/__main__.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/encoder.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/reranker.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/retriever/retriever.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/__init__.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/constants.py
RENAMED
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag/utils/pred_parse.py
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{flashrag-dev-0.1.3.dev20241115 → flashrag-dev-0.1.3.dev20241117}/flashrag_dev.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|