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

Changed litellm prints to tqdm and added execution metrics #45

Merged
merged 16 commits into from
Dec 7, 2024

Conversation

StanChan03
Copy link
Collaborator

@StanChan03 StanChan03 commented Nov 27, 2024

Replaced litellm prints with tqdm progress bar and added the execution metrics (cost and tokens)

Safe_mode implementation:
sem_extract - completed
sem_map - completed
sem_agg - completed
sem_topk - completed
sem_join - completed
sem_filter - completed

lotus/models/lm.py Outdated Show resolved Hide resolved
lotus/models/lm.py Outdated Show resolved Hide resolved
lotus/models/lm.py Outdated Show resolved Hide resolved
@StanChan03 StanChan03 requested a review from liana313 December 1, 2024 18:35
@liana313
Copy link
Collaborator

liana313 commented Dec 2, 2024

can you test the examples and check that the output is as intended? map.py in examples still prints out the LiteLLM calls, and then it's followed by a tqdm output

lotus/sem_ops/sem_join.py Outdated Show resolved Hide resolved
lotus/sem_ops/sem_join.py Outdated Show resolved Hide resolved
examples/op_examples/Skill:right_index/index Outdated Show resolved Hide resolved
examples/op_examples/join_cascade.py Outdated Show resolved Hide resolved
lotus/sem_ops/sem_join.py Outdated Show resolved Hide resolved
@@ -24,19 +29,23 @@ def __init__(
max_batch_size: int = 64,
tokenizer: Tokenizer | None = None,
max_cache_size: int = 1024,
safe_mode: 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.

We can remove safe_mode from LM because its not used here anymore.

@@ -47,6 +55,8 @@ def sem_extract(
lotus.logger.debug(f"raw_outputs: {lm_output.outputs}")
lotus.logger.debug(f"outputs: {postprocess_output.outputs}")

model.print_total_usage()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we do model.print_total_usage everywhere only if we are in safe mode?

estimated_quicksort_calls = 2 * len(docs) * np.log(len(docs))
estimated_total_calls = estimated_quickselect_calls + estimated_quicksort_calls
estimated_total_tokens = lotus.settings.lm.count_tokens(sample_prompt) * estimated_total_calls
print("Quicksort:")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's remove the Quicksort print, and similarly the Heap Sort print.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sidjha1 Naive sort as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup

@StanChan03 StanChan03 merged commit 99f96b2 into main Dec 7, 2024
6 checks passed
@StanChan03 StanChan03 deleted the sc/tqdm-and-usage branch December 27, 2024 08:16
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.

3 participants