11import pytest
22
3- from together .resources .finetune import createFinetuneRequest
3+ from together .resources .finetune import create_finetune_request
44from together .types .finetune import (
55 FinetuneTrainingLimits ,
66 FinetuneFullTrainingLimits ,
3030
3131
3232def test_simple_request ():
33- request = createFinetuneRequest (
33+ request = create_finetune_request (
3434 model_limits = _MODEL_LIMITS ,
3535 model = _MODEL_NAME ,
3636 training_file = _TRAINING_FILE ,
@@ -46,7 +46,7 @@ def test_simple_request():
4646
4747
4848def test_validation_file ():
49- request = createFinetuneRequest (
49+ request = create_finetune_request (
5050 model_limits = _MODEL_LIMITS ,
5151 model = _MODEL_NAME ,
5252 training_file = _TRAINING_FILE ,
@@ -61,14 +61,14 @@ def test_no_training_file():
6161 with pytest .raises (
6262 TypeError , match = "missing 1 required positional argument: 'training_file'"
6363 ):
64- _ = createFinetuneRequest (
64+ _ = create_finetune_request (
6565 model_limits = _MODEL_LIMITS ,
6666 model = _MODEL_NAME ,
6767 )
6868
6969
7070def test_lora_request ():
71- request = createFinetuneRequest (
71+ request = create_finetune_request (
7272 model_limits = _MODEL_LIMITS ,
7373 model = _MODEL_NAME ,
7474 training_file = _TRAINING_FILE ,
@@ -84,7 +84,7 @@ def test_lora_request():
8484
8585
8686def test_from_checkpoint_request ():
87- request = createFinetuneRequest (
87+ request = create_finetune_request (
8888 model_limits = _MODEL_LIMITS ,
8989 training_file = _TRAINING_FILE ,
9090 from_checkpoint = _FROM_CHECKPOINT ,
@@ -99,7 +99,7 @@ def test_both_from_checkpoint_model_name():
9999 ValueError ,
100100 match = "You must specify either a model or a checkpoint to start a job from, not both" ,
101101 ):
102- _ = createFinetuneRequest (
102+ _ = create_finetune_request (
103103 model_limits = _MODEL_LIMITS ,
104104 model = _MODEL_NAME ,
105105 training_file = _TRAINING_FILE ,
@@ -111,7 +111,7 @@ def test_no_from_checkpoint_no_model_name():
111111 with pytest .raises (
112112 ValueError , match = "You must specify either a model or a checkpoint"
113113 ):
114- _ = createFinetuneRequest (
114+ _ = create_finetune_request (
115115 model_limits = _MODEL_LIMITS ,
116116 training_file = _TRAINING_FILE ,
117117 )
@@ -122,7 +122,7 @@ def test_batch_size_limit():
122122 ValueError ,
123123 match = "Requested batch size is higher that the maximum allowed value" ,
124124 ):
125- _ = createFinetuneRequest (
125+ _ = create_finetune_request (
126126 model_limits = _MODEL_LIMITS ,
127127 model = _MODEL_NAME ,
128128 training_file = _TRAINING_FILE ,
@@ -132,7 +132,7 @@ def test_batch_size_limit():
132132 with pytest .raises (
133133 ValueError , match = "Requested batch size is lower that the minimum allowed value"
134134 ):
135- _ = createFinetuneRequest (
135+ _ = create_finetune_request (
136136 model_limits = _MODEL_LIMITS ,
137137 model = _MODEL_NAME ,
138138 training_file = _TRAINING_FILE ,
@@ -143,7 +143,7 @@ def test_batch_size_limit():
143143 ValueError ,
144144 match = "Requested batch size is higher that the maximum allowed value" ,
145145 ):
146- _ = createFinetuneRequest (
146+ _ = create_finetune_request (
147147 model_limits = _MODEL_LIMITS ,
148148 model = _MODEL_NAME ,
149149 training_file = _TRAINING_FILE ,
@@ -154,7 +154,7 @@ def test_batch_size_limit():
154154 with pytest .raises (
155155 ValueError , match = "Requested batch size is lower that the minimum allowed value"
156156 ):
157- _ = createFinetuneRequest (
157+ _ = create_finetune_request (
158158 model_limits = _MODEL_LIMITS ,
159159 model = _MODEL_NAME ,
160160 training_file = _TRAINING_FILE ,
@@ -167,7 +167,7 @@ def test_non_lora_model():
167167 with pytest .raises (
168168 ValueError , match = "LoRA adapters are not supported for the selected model."
169169 ):
170- _ = createFinetuneRequest (
170+ _ = create_finetune_request (
171171 model_limits = FinetuneTrainingLimits (
172172 max_num_epochs = 20 ,
173173 max_learning_rate = 1.0 ,
@@ -188,7 +188,7 @@ def test_non_full_model():
188188 with pytest .raises (
189189 ValueError , match = "Full training is not supported for the selected model."
190190 ):
191- _ = createFinetuneRequest (
191+ _ = create_finetune_request (
192192 model_limits = FinetuneTrainingLimits (
193193 max_num_epochs = 20 ,
194194 max_learning_rate = 1.0 ,
@@ -210,7 +210,7 @@ def test_non_full_model():
210210@pytest .mark .parametrize ("warmup_ratio" , [- 1.0 , 2.0 ])
211211def test_bad_warmup (warmup_ratio ):
212212 with pytest .raises (ValueError , match = "Warmup ratio should be between 0 and 1" ):
213- _ = createFinetuneRequest (
213+ _ = create_finetune_request (
214214 model_limits = _MODEL_LIMITS ,
215215 model = _MODEL_NAME ,
216216 training_file = _TRAINING_FILE ,
@@ -223,7 +223,7 @@ def test_bad_min_lr_ratio(min_lr_ratio):
223223 with pytest .raises (
224224 ValueError , match = "Min learning rate ratio should be between 0 and 1"
225225 ):
226- _ = createFinetuneRequest (
226+ _ = create_finetune_request (
227227 model_limits = _MODEL_LIMITS ,
228228 model = _MODEL_NAME ,
229229 training_file = _TRAINING_FILE ,
@@ -234,7 +234,7 @@ def test_bad_min_lr_ratio(min_lr_ratio):
234234@pytest .mark .parametrize ("max_grad_norm" , [- 1.0 , - 0.01 ])
235235def test_bad_max_grad_norm (max_grad_norm ):
236236 with pytest .raises (ValueError , match = "Max gradient norm should be non-negative" ):
237- _ = createFinetuneRequest (
237+ _ = create_finetune_request (
238238 model_limits = _MODEL_LIMITS ,
239239 model = _MODEL_NAME ,
240240 training_file = _TRAINING_FILE ,
@@ -245,7 +245,7 @@ def test_bad_max_grad_norm(max_grad_norm):
245245@pytest .mark .parametrize ("weight_decay" , [- 1.0 , - 0.01 ])
246246def test_bad_weight_decay (weight_decay ):
247247 with pytest .raises (ValueError , match = "Weight decay should be non-negative" ):
248- _ = createFinetuneRequest (
248+ _ = create_finetune_request (
249249 model_limits = _MODEL_LIMITS ,
250250 model = _MODEL_NAME ,
251251 training_file = _TRAINING_FILE ,
@@ -255,7 +255,7 @@ def test_bad_weight_decay(weight_decay):
255255
256256def test_bad_training_method ():
257257 with pytest .raises (ValueError , match = "training_method must be one of .*" ):
258- _ = createFinetuneRequest (
258+ _ = create_finetune_request (
259259 model_limits = _MODEL_LIMITS ,
260260 model = _MODEL_NAME ,
261261 training_file = _TRAINING_FILE ,
0 commit comments