Remote token output on startup

This commit is contained in:
Sean McLellan 2022-08-23 22:39:10 -04:00
parent a93a79568d
commit 84989f0d05

View File

@ -16,7 +16,6 @@ def get_clip_token_for_string(tokenizer, string):
batch_encoding = tokenizer(string, truncation=True, max_length=77, return_length=True,
return_overflowing_tokens=False, padding="max_length", return_tensors="pt")
tokens = batch_encoding["input_ids"]
sys.stdout.write(f"tokeme: {tokens}")
assert torch.count_nonzero(tokens - 49407) == 2, f"String '{string}' maps to more than a single token. Please use another string"
return tokens[0, 1]