From 241911d1d22dd0aed69946c96df71ae35e2982ac Mon Sep 17 00:00:00 2001 From: arkohut <39525455+arkohut@users.noreply.github.com> Date: Tue, 10 Sep 2024 00:58:57 +0800 Subject: [PATCH] feat(index): use different bs for embedding --- memos/commands.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/memos/commands.py b/memos/commands.py index 8092918..d44dc61 100644 --- a/memos/commands.py +++ b/memos/commands.py @@ -548,6 +548,9 @@ def index( library_id: int, folders: List[int] = typer.Option(None, "--folder", "-f"), force: bool = typer.Option(False, "--force", help="Force update all indexes"), + batchsize: int = typer.Option( + 4, "--batchsize", "-bs", help="Number of entities to index in a batch" + ), ): print(f"Indexing library {library_id}") @@ -607,9 +610,8 @@ def index( pbar.refresh() # Index each entity - batch_size = settings.batchsize - for i in range(0, len(entities), batch_size): - batch = entities[i : i + batch_size] + for i in range(0, len(entities), batchsize): + batch = entities[i : i + batchsize] to_index = [] for entity in batch: