@@ -76,6 +76,8 @@ def create_finetune_request(
7676 rpo_alpha : float | None = None ,
7777 simpo_gamma : float | None = None ,
7878 from_checkpoint : str | None = None ,
79+ from_hf_model : str | None = None ,
80+ hf_model_revision : str | None = None ,
7981 hf_api_token : str | None = None ,
8082 hf_output_repo_name : str | None = None ,
8183) -> FinetuneRequest :
@@ -87,6 +89,17 @@ def create_finetune_request(
8789 if model is None and from_checkpoint is None :
8890 raise ValueError ("You must specify either a model or a checkpoint" )
8991
92+ if from_checkpoint is not None and from_hf_model is not None :
93+ raise ValueError (
94+ "You must specify either a Hugging Face Hub model or a previous checkpoint from "
95+ "Together to start a job from, not both"
96+ )
97+
98+ if from_hf_model is not None and model is None :
99+ raise ValueError (
100+ "You must specify the base model to fine-tune a model from the Hugging Face Hub"
101+ )
102+
90103 model_or_checkpoint = model or from_checkpoint
91104
92105 if warmup_ratio is None :
@@ -251,6 +264,8 @@ def create_finetune_request(
251264 wandb_name = wandb_name ,
252265 training_method = training_method_cls ,
253266 from_checkpoint = from_checkpoint ,
267+ from_hf_model = from_hf_model ,
268+ hf_model_revision = hf_model_revision ,
254269 hf_api_token = hf_api_token ,
255270 hf_output_repo_name = hf_output_repo_name ,
256271 )
@@ -332,6 +347,8 @@ def create(
332347 rpo_alpha : float | None = None ,
333348 simpo_gamma : float | None = None ,
334349 from_checkpoint : str | None = None ,
350+ from_hf_model : str | None = None ,
351+ hf_model_revision : str | None = None ,
335352 hf_api_token : str | None = None ,
336353 hf_output_repo_name : str | None = None ,
337354 ) -> FinetuneResponse :
@@ -390,6 +407,11 @@ def create(
390407 from_checkpoint (str, optional): The checkpoint identifier to continue training from a previous fine-tuning job.
391408 The format: {$JOB_ID/$OUTPUT_MODEL_NAME}:{$STEP}.
392409 The step value is optional, without it the final checkpoint will be used.
410+ from_hf_model (str, optional): The Hugging Face Hub repo to start training from.
411+ Should be as close as possible to the base model (specified by the `model` argument) in terms of architecture and size.
412+ hf_model_revision (str, optional): The revision of the Hugging Face Hub model to continue training from. Defaults to None.
413+ Example: hf_model_revision=None (defaults to the latest revision in `main`) or
414+ hf_model_revision="607a30d783dfa663caf39e06633721c8d4cfcd7e" (specific commit).
393415 hf_api_token (str, optional): API key for the Hugging Face Hub. Defaults to None.
394416 hf_output_repo_name (str, optional): HF repo to upload the fine-tuned model to. Defaults to None.
395417
@@ -445,6 +467,8 @@ def create(
445467 rpo_alpha = rpo_alpha ,
446468 simpo_gamma = simpo_gamma ,
447469 from_checkpoint = from_checkpoint ,
470+ from_hf_model = from_hf_model ,
471+ hf_model_revision = hf_model_revision ,
448472 hf_api_token = hf_api_token ,
449473 hf_output_repo_name = hf_output_repo_name ,
450474 )
@@ -759,6 +783,8 @@ async def create(
759783 rpo_alpha : float | None = None ,
760784 simpo_gamma : float | None = None ,
761785 from_checkpoint : str | None = None ,
786+ from_hf_model : str | None = None ,
787+ hf_model_revision : str | None = None ,
762788 hf_api_token : str | None = None ,
763789 hf_output_repo_name : str | None = None ,
764790 ) -> FinetuneResponse :
@@ -817,6 +843,11 @@ async def create(
817843 from_checkpoint (str, optional): The checkpoint identifier to continue training from a previous fine-tuning job.
818844 The format: {$JOB_ID/$OUTPUT_MODEL_NAME}:{$STEP}.
819845 The step value is optional, without it the final checkpoint will be used.
846+ from_hf_model (str, optional): The Hugging Face Hub repo to start training from.
847+ Should be as close as possible to the base model (specified by the `model` argument) in terms of architecture and size.
848+ hf_model_revision (str, optional): The revision of the Hugging Face Hub model to continue training from. Defaults to None.
849+ Example: hf_model_revision=None (defaults to the latest revision in `main`) or
850+ hf_model_revision="607a30d783dfa663caf39e06633721c8d4cfcd7e" (specific commit).
820851 hf_api_token (str, optional): API key for the Huggging Face Hub. Defaults to None.
821852 hf_output_repo_name (str, optional): HF repo to upload the fine-tuned model to. Defaults to None.
822853
@@ -872,6 +903,8 @@ async def create(
872903 rpo_alpha = rpo_alpha ,
873904 simpo_gamma = simpo_gamma ,
874905 from_checkpoint = from_checkpoint ,
906+ from_hf_model = from_hf_model ,
907+ hf_model_revision = hf_model_revision ,
875908 hf_api_token = hf_api_token ,
876909 hf_output_repo_name = hf_output_repo_name ,
877910 )
0 commit comments