Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "together"
version = "1.5.10"
version = "1.5.11"
authors = ["Together AI <[email protected]>"]
description = "Python client for Together's Cloud Platform!"
readme = "README.md"
Expand Down
5 changes: 5 additions & 0 deletions src/together/resources/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def create_finetune_request(
raise ValueError(
f"LoRA adapters are not supported for the selected model ({model_or_checkpoint})."
)

if lora_dropout is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

this can be simplified to if lora_dropout

if not 0 <= lora_dropout < 1.0:
raise ValueError("LoRA dropout must be in [0, 1) range.")

lora_r = lora_r if lora_r is not None else model_limits.lora_training.max_rank
lora_alpha = lora_alpha if lora_alpha is not None else lora_r * 2
training_type = LoRATrainingType(
Expand Down
26 changes: 26 additions & 0 deletions tests/unit/test_finetune_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,32 @@ def test_lora_request():
assert request.batch_size == _MODEL_LIMITS.lora_training.max_batch_size


@pytest.mark.parametrize("lora_dropout", [-1, 0, 0.5, 1.0, 10.0])
def test_lora_request_with_lora_dropout(lora_dropout: float):

if 0 <= lora_dropout < 1:
request = create_finetune_request(
model_limits=_MODEL_LIMITS,
model=_MODEL_NAME,
training_file=_TRAINING_FILE,
lora=True,
lora_dropout=lora_dropout,
)
assert request.training_type.lora_dropout == lora_dropout
else:
with pytest.raises(
ValueError,
match=r"LoRA dropout must be in \[0, 1\) range.",
):
create_finetune_request(
model_limits=_MODEL_LIMITS,
model=_MODEL_NAME,
training_file=_TRAINING_FILE,
lora=True,
lora_dropout=lora_dropout,
)
Comment on lines +105 to +111
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why we need this but if it successfully detects out of range dropouts that's fine with me.



def test_dpo_request_lora():
request = create_finetune_request(
model_limits=_MODEL_LIMITS,
Expand Down