Skip to content

Conversation

@dbczumar
Copy link
Collaborator

Add retries to LM calls with LiteLLM, and improve LM docstrings while we're here

Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
cache: bool = True,
launch_kwargs: Optional[Dict[str, Any]] = None,
callbacks: Optional[List[BaseCallback]] = None,
num_retries: int = 8,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Empirically, 8 retries with exponential backoff in LiteLLM takes just over 1 minute with LiteLLM's builtin / default retry strategy. I defer to their exponential backoff retry strategy defaults, rather than defining our own (presumably, they know best)

temperature: float = 0.0,
max_tokens: int = 1000,
cache: bool = True,
launch_kwargs: Optional[Dict[str, Any]] = None,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't document this parameter because it's not actually used

Signed-off-by: dbczumar <corey.zumar@databricks.com>
cache_finetune=cache_finetune
)
executor.submit(execute_finetune_job, finetune_job, lm=self, cache_finetune=cache_finetune)
executor.shutdown(wait=False)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just linter formatting

Comment on lines -107 to -113
self,
train_data: List[Dict[str, Any]],
train_kwargs: Optional[Dict[str, Any]]=None,
train_method: TrainingMethod = TrainingMethod.SFT,
provider: str = "openai",
cache_finetune: bool = True,
) -> FinetuneJob:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just linter formatting

Comment on lines -14 to -17
from dspy.clients.lm_finetune_utils import (
execute_finetune_job,
get_provider_finetune_job_class,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just linter formatting

Signed-off-by: dbczumar <corey.zumar@databricks.com>
@dbczumar dbczumar requested a review from okhat October 30, 2024 01:30
@okhat okhat merged commit a824ece into stanfordnlp:main Oct 30, 2024
4 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