mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-15 10:14:32 +00:00
fix: Update count_tokens function in utils.py
This commit is contained in:
1 parent
de0193fffc
commit
431755144e
1 file changed
+2
-2
@@ -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'])
|
||||
Reference in new issue
Block a user