From 75a2edbe86acba0ee56ddf82bf2fa4829e963155 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 25 Sep 2023 14:16:41 +0000 Subject: [PATCH 1/2] style: linting --- src/seb/seb_models/e5_models.py | 3 +-- src/seb/seb_models/openai_models.py | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/seb/seb_models/e5_models.py b/src/seb/seb_models/e5_models.py index 8fa6a9f1..18f0ff13 100644 --- a/src/seb/seb_models/e5_models.py +++ b/src/seb/seb_models/e5_models.py @@ -1,4 +1,3 @@ -import stat from functools import partial from seb import ModelInterface, ModelMeta, SebModel, models @@ -21,7 +20,7 @@ def preprocess(sentences: list[str]) -> list[str]: return sentences def encode( - self, sentences: list[str], batch_size: int = 32, **kwargs: dict + self, sentences: list[str], batch_size: int = 32, **kwargs: dict, ) -> list[ArrayLike]: sentences = self.preprocess(sentences) return self.mdl.encode(sentences, batch_size=batch_size, **kwargs) # type: ignore diff --git a/src/seb/seb_models/openai_models.py b/src/seb/seb_models/openai_models.py index 4fd8e6b5..f0341636 100644 --- a/src/seb/seb_models/openai_models.py +++ b/src/seb/seb_models/openai_models.py @@ -26,7 +26,8 @@ def preprocess(sentences: Sequence[str]) -> Sequence[str]: @staticmethod def create_sentence_blocks( - sentences: Sequence[str], block_size: int, + sentences: Sequence[str], + block_size: int, ) -> list[Sequence[str]]: sent_blocks: list[Sequence[str]] = [] for i in range(0, len(sentences), block_size): @@ -44,7 +45,8 @@ def embed(sentences: Sequence[str]) -> torch.Tensor: try: emb = openai.Embedding.create( - input=sentences, model="text-embedding-ada-002", + input=sentences, + model="text-embedding-ada-002", ) except InvalidRequestError as e: if "Please reduce your prompt" in e._message: # type: ignore From 44e30055245914df854de90daf11a4f07d9aad31 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 25 Sep 2023 14:17:34 +0000 Subject: [PATCH 2/2] style: linting --- src/seb/seb_models/e5_models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/seb/seb_models/e5_models.py b/src/seb/seb_models/e5_models.py index 18f0ff13..d2f515fb 100644 --- a/src/seb/seb_models/e5_models.py +++ b/src/seb/seb_models/e5_models.py @@ -20,7 +20,10 @@ def preprocess(sentences: list[str]) -> list[str]: return sentences def encode( - self, sentences: list[str], batch_size: int = 32, **kwargs: dict, + self, + sentences: list[str], + batch_size: int = 32, + **kwargs: dict, ) -> list[ArrayLike]: sentences = self.preprocess(sentences) return self.mdl.encode(sentences, batch_size=batch_size, **kwargs) # type: ignore