-
Notifications
You must be signed in to change notification settings - Fork 43.3k
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
Fix the maximum context length issue by chunking #3222
Fix the maximum context length issue by chunking #3222
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #3222 +/- ##
==========================================
+ Coverage 60.31% 60.55% +0.24%
==========================================
Files 69 69
Lines 3152 3184 +32
Branches 525 528 +3
==========================================
+ Hits 1901 1928 +27
- Misses 1118 1122 +4
- Partials 133 134 +1
☔ View full report in Codecov by Sentry. |
@Pwuts I think this change can fix and close multiple open issues. Could you please review, approve and merge? |
Please link issues if this PR resolves them |
Also, this is missing test coverage. Can you fix that (using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add unit tests using pytest
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
endless crashes since 4 days a lot but happening less often since 2-3 weeks. Crashed 4 times in a row and constantly for 3 hours every restart. Here is some code to cap the max length for GPT3.5t because max is about 8191 tokens so to be save under 24000 seems to be fine most of the time here the code: |
This comment was marked as off-topic.
This comment was marked as off-topic.
Add basic unit test for the new chunked func
314426b
to
c744134
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
Linked the issues that this PR is going to fix and added a unit test for the new chunk token func |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
…-fix-character-length-Significant-Gravitas#3222
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best we can do for now; we'll have to iterate on this when reworking the memory system
d0c50ba
to
82c5ae0
Compare
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size |
82c5ae0
to
4cf73f7
Compare
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size |
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size |
af070d7
to
5b8f5aa
Compare
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size |
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size |
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size |
I've committed the changes to the master branch locally. /lib/python3.10/site-packages/openai/api_requestor.py", line 682, in _interpret_response_line |
@arrfonseca could you paste your call stack? The steps how to reproduce? This PR only fixed the max length issue using embeddings around memory.add which multiple commands used. |
Im asking the AI to make a screenplay in 5 parts of 15 minutes on a text book. I have the text in .tx format Traceback (most recent call last): Before that the call, if I get this right, was:
After the authorization the process displayed all the book text in the terminal window, without line breaks or anything. Than autogpt crashed. I'm working in the master branch after a git pull. |
So sorry about that. I realized I had to switch to the branch fix/crash-on-context-overflow and it gives me |
It's a new bug introduced from a change in memory management. |
That (new) issue should be mitigated by #3646 while we work on a better and more permanent fix |
Can someone please guide me to a newbie's guide for how to implement the patch changes you guys are releasing? I get this error all the time. I see that this individual has corrected it by modifying 9 files. Is there an easy way to implement the changes without going through each file and making the changes manually? I am worried I may miss something and I'm not as astute with modifying auto-gpt. thank you in advance, and sorry for the newb question. |
@meanostrich I would advise against applying individual patches. Instead, keep an eye on our GitHub and other channels for new releases which contain the newest patches. |
Background
Multiple issues opened about the same issue, e.g. #2801 #2871 #2906 and more, which multiple commands calls memory.add() which then calls create_embedding_with_ada, in the cases where the input text exceeds the model's 8191 token limit, we will get an InvalidRequestError saying that "This model's maximum context length is 8191 tokens...".
Resolves #2801, resolves #2871, resolves #2906, resolves #3244
Changes
The issue is fixed by chunking the input text, then running embedding individually and then combining by weighted averaging. This approach is suggested by the OpenAI. This change model after OpenAI Cookbook. This PR should fix numbers of open issues including the ones mentioned above and more.
PR Quality Checklist