diff --git a/app.py b/app.py index 46bcdd3..66405bd 100644 --- a/app.py +++ b/app.py @@ -38,10 +38,10 @@ def startup_event(): logger.info("Running on CPU") # Batch text tokenization enabled by default - direct_tokenize = True + direct_tokenize = False transformers_direct_tokenize = os.getenv("T2V_TRANSFORMERS_DIRECT_TOKENIZE") - if transformers_direct_tokenize is not None and transformers_direct_tokenize == "false" or transformers_direct_tokenize == "0": - direct_tokenize = False + if transformers_direct_tokenize is not None and transformers_direct_tokenize == "true" or transformers_direct_tokenize == "1": + direct_tokenize = True meta_config = Meta('./models/model') vec = Vectorizer('./models/model', cuda_support, cuda_core, cuda_per_process_memory_fraction, diff --git a/vectorizer.py b/vectorizer.py index 2b993d1..994f972 100644 --- a/vectorizer.py +++ b/vectorizer.py @@ -67,7 +67,7 @@ def pool_embedding(self, batch_results, tokens, config): async def vectorize(self, text: str, config: VectorInputConfig): with torch.no_grad(): - if not self.direct_tokenize: + if self.direct_tokenize: # create embeddings without tokenizing text tokens = self.tokenize(text) if self.cuda: