-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add retries to LM calls with LiteLLM #1718
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
Conversation
| cache: bool = True, | ||
| launch_kwargs: Optional[Dict[str, Any]] = None, | ||
| callbacks: Optional[List[BaseCallback]] = None, | ||
| num_retries: int = 8, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
| cache_finetune=cache_finetune | ||
| ) | ||
| executor.submit(execute_finetune_job, finetune_job, lm=self, cache_finetune=cache_finetune) | ||
| executor.shutdown(wait=False) |
There was a problem hiding this comment.
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
| 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: |
There was a problem hiding this comment.
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
| from dspy.clients.lm_finetune_utils import ( | ||
| execute_finetune_job, | ||
| get_provider_finetune_job_class, | ||
| ) |
There was a problem hiding this comment.
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
Add retries to LM calls with LiteLLM, and improve LM docstrings while we're here