@@ -133,27 +133,22 @@ def create_finetune_request(
133133 min_batch_size = model_limits .full_training .min_batch_size
134134 max_batch_size_dpo = model_limits .full_training .max_batch_size_dpo
135135
136- if batch_size == "max" :
137- if training_method == "dpo" :
138- batch_size = max_batch_size_dpo
139- else :
140- batch_size = max_batch_size
136+ if batch_size != "max" :
137+ if training_method == "sft" :
138+ if batch_size > max_batch_size :
139+ raise ValueError (
140+ f"Requested batch size of { batch_size } is higher that the maximum allowed value of { max_batch_size } ."
141+ )
142+ elif training_method == "dpo" :
143+ if batch_size > max_batch_size_dpo :
144+ raise ValueError (
145+ f"Requested batch size of { batch_size } is higher that the maximum allowed value of { max_batch_size_dpo } ."
146+ )
141147
142- if training_method == "sft" :
143- if batch_size > max_batch_size :
148+ if batch_size < min_batch_size :
144149 raise ValueError (
145- f"Requested batch size of { batch_size } is higher that the maximum allowed value of { max_batch_size } ."
150+ f"Requested batch size of { batch_size } is lower that the minimum allowed value of { min_batch_size } ."
146151 )
147- elif training_method == "dpo" :
148- if batch_size > max_batch_size_dpo :
149- raise ValueError (
150- f"Requested batch size of { batch_size } is higher that the maximum allowed value of { max_batch_size_dpo } ."
151- )
152-
153- if batch_size < min_batch_size :
154- raise ValueError (
155- f"Requested batch size of { batch_size } is lower that the minimum allowed value of { min_batch_size } ."
156- )
157152
158153 if warmup_ratio > 1 or warmup_ratio < 0 :
159154 raise ValueError (f"Warmup ratio should be between 0 and 1 (got { warmup_ratio } )" )
0 commit comments