You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assume we have a list of PDF filenames and we have a function embed(pdf_filename, slide_no). Now we would like to establish a persistent cache for the results of this function. E.g. today I call the function with parameters "test.pdf" and 0 ( for the first slide), it will return a vector of 1500 numbers. It takes a while to compute this. Hence, if I call the function again tomorrow, the computation should be avoided. Instead we retrieve the vector from a persistent storage; a file.
git-bob think about strategies to achieve this
The text was updated successfully, but these errors were encountered:
This message was generated by git-bob (version: 0.12.0, model: github_models:gpt-4o, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.
To establish a persistent cache for the embed function, you can use Python's shelve module, which provides a simple persistent storage for key-value pairs. Here's a basic implementation strategy:
With this setup, the cache_embed function will first check if the result is already in the cache. If it is, the cached result is returned. Otherwise, it computes the result and stores it in the cache for future use. This avoids redundant computations and leverages disk storage for persistence across sessions.
Assume we have a list of PDF filenames and we have a function
embed(pdf_filename, slide_no)
. Now we would like to establish a persistent cache for the results of this function. E.g. today I call the function with parameters "test.pdf" and 0 ( for the first slide), it will return a vector of 1500 numbers. It takes a while to compute this. Hence, if I call the function again tomorrow, the computation should be avoided. Instead we retrieve the vector from a persistent storage; a file.git-bob think about strategies to achieve this
The text was updated successfully, but these errors were encountered: