Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix T2V_TRANSFORMERS_DIRECT_TOKENIZE setting #47

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion vectorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down