-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Speed up + streamline prompt template rendering runtime #1286
Comments
I'll probably take on change 1 sooner rather than later--but if no PR can be seen that references this issue yet, then anyone interested can comment here volunteering to add it too! |
Hi ! Happy to help if you have any question regarding FYI it dumps the function using Though you can override this mechanism by passing your own |
In some situations (for example, N-shot with very large N) we currently spend an annoying amount of time redundantly rendering our Jinja2 prompt template strings.
There are two ways we can significantly cut down on this runtime, without impacting code complexity significantly (e.g., no multiprocessing when generating requests / Instances, etc.)
doc_to_target
,doc_to_text
,doc_to_choice
once each for every doc, and cache that result so that we don't need to repeatedly render our prompts when we want to call these methods multiple times for every test instance.dataset.map()
function which can cache results based on pickling a function. However, we'd want to be extremely cautious of whether this might create weird bugs when someone is trying to change + rerun a task but the cached intermediate input objects get silently used, preventing them from seeing the expected changes in behavior when they change code.Change 1 should suffice for some pretty nice QoL improvements.
We should however also make sure this doesn't negatively affect runtime when we'd have to perform it on a large train set that we're drawing few-shot examples from.
The text was updated successfully, but these errors were encountered: