-
Notifications
You must be signed in to change notification settings - Fork 21
feat: add price estimation #400
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
Changes from 5 commits
efefbbb
2ee9bbc
d35e770
5eaea00
f73533d
dea7fdf
a422b53
ca42382
3c11c5f
faffc82
dc923a4
9897bc6
aa0d8e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,8 @@ | |||||||||
| FinetuneLRScheduler, | ||||||||||
| FinetuneRequest, | ||||||||||
| FinetuneResponse, | ||||||||||
| FinetunePriceEstimationRequest, | ||||||||||
| FinetunePriceEstimationResponse, | ||||||||||
| FinetuneTrainingLimits, | ||||||||||
| FullTrainingType, | ||||||||||
| LinearLRScheduler, | ||||||||||
|
|
@@ -31,7 +33,7 @@ | |||||||||
| TrainingMethodSFT, | ||||||||||
| TrainingType, | ||||||||||
| ) | ||||||||||
| from together.types.finetune import DownloadCheckpointType | ||||||||||
| from together.types.finetune import DownloadCheckpointType, TrainingMethod | ||||||||||
| from together.utils import log_warn_once, normalize_key | ||||||||||
|
|
||||||||||
|
|
||||||||||
|
|
@@ -42,6 +44,12 @@ | |||||||||
| TrainingMethodSFT().method, | ||||||||||
| TrainingMethodDPO().method, | ||||||||||
| } | ||||||||||
| _WARNING_MESSAGE_INSUFFICIENT_FUNDS = ( | ||||||||||
| "The estimated price of the fine-tuning job is {} which is significantly " | ||||||||||
| "greater than your current credit limit and balance combined. " | ||||||||||
| "It will likely fail due to insufficient funds. " | ||||||||||
| "Please proceed at your own risk." | ||||||||||
|
||||||||||
| "It will likely fail due to insufficient funds. " | |
| "Please proceed at your own risk." | |
| "It will likely get cancelled due to insufficient funds. " | |
| "Proceed at your own risk." |
Outdated
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.
Can these fields be 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.
They can in principle, but the price estimation API doesn't seem to support it. Therefore, we need to fix the API, disable calling the estimation when model is None, but set this field to always be defined (i.e., remove the None option)
Outdated
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.
The docstring is not consistent with the actual arguments
Outdated
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.
We don't need to set them None here, as they're defined below in all branches (or exception). You can keep type definition if you want to
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.
mypy complains
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.
That's a bit weird, all the possible branches are covered below.
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.
Does it complain when you don't define the type or when you don't set it to None?
newokaerinasai marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
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.
Same here
newokaerinasai marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -308,6 +308,32 @@ def validate_training_type(cls, v: TrainingType) -> TrainingType: | |
| raise ValueError("Unknown training type") | ||
|
|
||
|
|
||
| class FinetunePriceEstimationRequest(BaseModel): | ||
| """ | ||
| Fine-tune price estimation request type | ||
| """ | ||
|
|
||
| training_file: str | ||
| validation_file: str | None = None | ||
| model: str | ||
| n_epochs: int | None = None | ||
| n_evals: int | None = None | ||
| training_type: TrainingType | None = None | ||
|
||
| training_method: TrainingMethodSFT | TrainingMethodDPO | ||
|
|
||
|
|
||
| class FinetunePriceEstimationResponse(BaseModel): | ||
| """ | ||
| Fine-tune price estimation response type | ||
| """ | ||
|
|
||
| estimated_total_price: float | ||
| user_limit: float | ||
| estimated_train_token_count: int | ||
| estimated_eval_token_count: int | ||
| allowed_to_proceed: bool | ||
|
|
||
|
|
||
| class FinetuneList(BaseModel): | ||
| # object type | ||
| object: Literal["list"] | None = None | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.