Skip to content

Commit

Permalink
fix: Update count_tokens function in utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dartpain committed May 4, 2024
1 parent de0193f commit 4317551
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions application/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from transformers import GPT2TokenizerFast


tokenizer = GPT2TokenizerFast.from_pretrained('gpt2')
def count_tokens(string):
tokenizer = GPT2TokenizerFast.from_pretrained('gpt2')

return len(tokenizer(string)['input_ids'])

0 comments on commit 4317551

Please sign in to comment.