Skip to content

Commit

Permalink
empty dir and file fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ouonline committed Nov 20, 2024
1 parent c2bb6ff commit b97f9d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 0 additions & 3 deletions examples/rag_milvus_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ def __init__(self):
self.root_dir = os.path.expanduser(os.path.join(config['home'], 'rag_for_ut'))
self.rag_dir = os.path.join(self.root_dir, 'rag_master')
os.makedirs(self.rag_dir, exist_ok=True)
# creates a dummy file for rag
with open(os.path.join(self.rag_dir, '_dummy.txt'), "wb") as fd:
fd.write(b'dsfjfasfkjdsfewifjewofjefiejw')
self.store_file = os.path.join(self.root_dir, "milvus.db")

def __del__(self):
Expand Down
2 changes: 1 addition & 1 deletion lazyllm/tools/rag/doc_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def _add_files(self, input_files: List[str], ids: Optional[List[str]] = None,
all_groups = self.store.all_groups()
LOG.info(f"add_files: Trying to merge store with {all_groups}")
for group in all_groups:
if not self.store.is_group_active(group):
if group != LAZY_ROOT_NAME and not self.store.is_group_active(group):
continue
# Duplicate group will be discarded automatically
nodes = self._get_nodes(group, temp_store)
Expand Down
3 changes: 3 additions & 0 deletions lazyllm/tools/rag/rerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def __init__(self, name: str = "ModuleReranker", target: Optional[str] = None,
self._reranker = lazyllm.TrainableModule(self._kwargs['model'])

def forward(self, nodes: List[DocNode], query: str = "") -> List[DocNode]:
if not nodes:
return []

docs = [node.get_text(metadata_mode=MetadataMode.EMBED) for node in nodes]
top_n = self._kwargs['topk'] if 'topk' in self._kwargs else len(docs)
if self._reranker._deploy_type == lazyllm.deploy.Infinity:
Expand Down

0 comments on commit b97f9d8

Please sign in to comment.