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

Throwing OutOfMemoryException while getting encoding model #35

Open
CodePlacer opened this issue Jun 4, 2024 Discussed in #28 · 0 comments
Open

Throwing OutOfMemoryException while getting encoding model #35

CodePlacer opened this issue Jun 4, 2024 Discussed in #28 · 0 comments

Comments

@CodePlacer
Copy link

Discussed in #28

Originally posted by CodePlacer May 10, 2024
When calling below method to get the encoding for model gpt-4, am getting out of memory exception. Exception is not throwing all the time. Its throwing in some times and not able to understand the exact cause. Can you please help?

Version Used
1.1.3

Code

string model = "gpt-4";
var encoding = Tiktoken.Encoding.ForModel(model);

Error Stack

Exception of type System.OutOfMemoryException was thrown.","stackTrace":" at System.Collections.Generic.Dictionary\u00602.Initialize(Int32 capacity)\r\n at System.Collections.Generic.Dictionary\u00602..ctor(Int32 capacity, IEqualityComparer\u00601 comparer)\r\n at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable\u00601 source, Func\u00602 keySelector, Func\u00602 elementSelector, IEqualityComparer\u00601 comparer)\r\n at Tiktoken.CoreBpe..ctor(IReadOnlyDictionary\u00602 encoder, IReadOnlyDictionary\u00602 specialTokensEncoder, String pattern) in //src/libs/Tiktoken/CoreBPE.cs:line 44\r\n at Tiktoken.Encoding..ctor(EncodingSettingModel setting) in //src/libs/Tiktoken/Encoding.cs:line 80\r\n at Tiktoken.Encoding.Get(String encodingName) in /_/src/libs/Tiktoken/Encoding.cs:line 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant