@@ -228,6 +228,7 @@ def tune_model(
228
228
tuning_evaluation_spec : Optional ["TuningEvaluationSpec" ] = None ,
229
229
default_context : Optional [str ] = None ,
230
230
accelerator_type : Optional [_ACCELERATOR_TYPE_TYPE ] = None ,
231
+ max_context_length : Optional [str ] = None ,
231
232
) -> "_LanguageModelTuningJob" :
232
233
"""Tunes a model based on training data.
233
234
@@ -253,6 +254,8 @@ def tune_model(
253
254
tuning_evaluation_spec: Specification for the model evaluation during tuning.
254
255
default_context: The context to use for all training samples by default.
255
256
accelerator_type: Type of accelerator to use. Can be "TPU" or "GPU".
257
+ max_context_length: The max context length used for tuning.
258
+ Can be either '8k' or '32k'
256
259
257
260
Returns:
258
261
A `LanguageModelTuningJob` object that represents the tuning job.
@@ -313,6 +316,9 @@ def tune_model(
313
316
)
314
317
tuning_parameters ["accelerator_type" ] = accelerator_type
315
318
319
+ if max_context_length :
320
+ tuning_parameters ["max_context_length" ] = max_context_length
321
+
316
322
return self ._tune_model (
317
323
training_data = training_data ,
318
324
tuning_parameters = tuning_parameters ,
@@ -600,6 +606,7 @@ def tune_model(
600
606
model_display_name : Optional [str ] = None ,
601
607
tuning_evaluation_spec : Optional ["TuningEvaluationSpec" ] = None ,
602
608
accelerator_type : Optional [_ACCELERATOR_TYPE_TYPE ] = None ,
609
+ max_context_length : Optional [str ] = None ,
603
610
) -> "_LanguageModelTuningJob" :
604
611
"""Tunes a model based on training data.
605
612
@@ -621,6 +628,8 @@ def tune_model(
621
628
model_display_name: Custom display name for the tuned model.
622
629
tuning_evaluation_spec: Specification for the model evaluation during tuning.
623
630
accelerator_type: Type of accelerator to use. Can be "TPU" or "GPU".
631
+ max_context_length: The max context length used for tuning.
632
+ Can be either '8k' or '32k'
624
633
625
634
Returns:
626
635
A `LanguageModelTuningJob` object that represents the tuning job.
@@ -641,6 +650,7 @@ def tune_model(
641
650
model_display_name = model_display_name ,
642
651
tuning_evaluation_spec = tuning_evaluation_spec ,
643
652
accelerator_type = accelerator_type ,
653
+ max_context_length = max_context_length ,
644
654
)
645
655
646
656
@@ -659,6 +669,7 @@ def tune_model(
659
669
model_display_name : Optional [str ] = None ,
660
670
tuning_evaluation_spec : Optional ["TuningEvaluationSpec" ] = None ,
661
671
accelerator_type : Optional [_ACCELERATOR_TYPE_TYPE ] = None ,
672
+ max_context_length : Optional [str ] = None ,
662
673
) -> "_LanguageModelTuningJob" :
663
674
"""Tunes a model based on training data.
664
675
@@ -687,6 +698,8 @@ def tune_model(
687
698
model_display_name: Custom display name for the tuned model.
688
699
tuning_evaluation_spec: Specification for the model evaluation during tuning.
689
700
accelerator_type: Type of accelerator to use. Can be "TPU" or "GPU".
701
+ max_context_length: The max context length used for tuning.
702
+ Can be either '8k' or '32k'
690
703
691
704
Returns:
692
705
A `LanguageModelTuningJob` object that represents the tuning job.
@@ -708,6 +721,7 @@ def tune_model(
708
721
model_display_name = model_display_name ,
709
722
tuning_evaluation_spec = tuning_evaluation_spec ,
710
723
accelerator_type = accelerator_type ,
724
+ max_context_length = max_context_length ,
711
725
)
712
726
tuned_model = job .get_tuned_model ()
713
727
self ._endpoint = tuned_model ._endpoint
0 commit comments