RuntimeError(StackOverflow) with tiktoken.encoding_for_model('gpt-4').encode(txt, disallowed_special=())
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 19.3k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
we are using tiktoken 0.5.2 to calculate the token count. It is working most of the time, but we are seeing the error: RuntimeError(StackOverflow) with one of the runs.
Here is the part of the stack trace:
SystemLog: File "/azureml-envs/azureml_40acd812113c64de92b8cc12dc98c336/lib/python3.11/site-packages/tiktoken/core.py", line 120, in encode
SystemLog: return self._core_bpe.encode(text, allowed_special)
I also checked the text size and it's pretty big (around 2 GB) is there any limitation on the size?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at tiktoken/core.py line 120 and reproduce the reported RuntimeError(StackOverflow) using a similarly large input with tiktoken 0.5.2. Check whether the failure is tied to input size or encoding behavior, then establish and test the supported behavior for large text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100