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

operator level cache #65

Merged
merged 22 commits into from
Dec 27, 2024
Merged

operator level cache #65

merged 22 commits into from
Dec 27, 2024

Conversation

StanChan03
Copy link
Collaborator

Implement operator level caching

@StanChan03 StanChan03 changed the title sem_extract+sem_map level cache operator level cache Dec 26, 2024
@@ -14,6 +15,7 @@ def sem_agg(
partition_ids: list[int],
safe_mode: bool = False,
progress_bar_desc: str = "Aggregating",
use_operator_cache: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High level question - should use_operator_cache be a parameter here or is it better off in Settings? I think there is an argument for the latter, since I see this pattern being used everywhere.

Copy link
Collaborator Author

@StanChan03 StanChan03 Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

putting it in settings is better I'd say. I can put it in settings

@sidjha1
Copy link
Collaborator

sidjha1 commented Dec 27, 2024

Looks pretty clean! Can we also add some tests to make sure that the behavior is as intended.

@@ -13,6 +13,7 @@ class Settings:

# Cache settings
enable_cache: bool = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can enable_cache be renamed to enable_messsage_cache so its clear what the distinction is

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea I can do that

lotus/cache.py Outdated

cached_result = model.cache.get(cache_key)
if cached_result is not None:
print(f"Cache hit for {cache_key}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use lotus.logger rather than prints.

@StanChan03 StanChan03 merged commit 9761855 into main Dec 27, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants