88from together .utils import finetune_price_to_dollars , parse_timestamp
99
1010
11- @click .group (name = "fine-tune " )
11+ @click .group (name = "fine-tuning " )
1212@click .pass_context
13- def fine_tune (ctx : click .Context ) -> None :
13+ def fine_tuning (ctx : click .Context ) -> None :
1414 """Fine-tunes API commands"""
1515 pass
1616
1717
18- @fine_tune .command ()
18+ @fine_tuning .command ()
1919@click .pass_context
2020@click .option (
21- "--training_file " , type = str , required = True , help = "Training file ID from Files API"
21+ "--training-file " , type = str , required = True , help = "Training file ID from Files API"
2222)
2323@click .option ("--model" , type = str , required = True , help = "Base model name" )
2424@click .option ("--n-epochs" , type = int , default = 1 , help = "Number of epochs to train for" )
@@ -30,7 +30,7 @@ def fine_tune(ctx: click.Context) -> None:
3030@click .option (
3131 "--suffix" , type = str , default = None , help = "Suffix for the fine-tuned model name"
3232)
33- @click .option ("--wandb-api-key" , prompt = True , hide_input = True , help = "Wandb API key" )
33+ @click .option ("--wandb-api-key" , type = str , default = None , help = "Wandb API key" )
3434def create (
3535 ctx : click .Context ,
3636 training_file : str ,
@@ -59,10 +59,10 @@ def create(
5959 click .echo (json .dumps (response .model_dump (), indent = 4 ))
6060
6161
62- @fine_tune .command ()
62+ @fine_tuning .command ()
6363@click .pass_context
6464def list (ctx : click .Context ) -> None :
65- """List fine-tuning tasks """
65+ """List fine-tuning jobs """
6666 client : Together = ctx .obj
6767
6868 response = client .fine_tuning .list ()
@@ -89,38 +89,34 @@ def list(ctx: click.Context) -> None:
8989 click .echo (table )
9090
9191
92- @fine_tune .command ()
92+ @fine_tuning .command ()
9393@click .pass_context
9494@click .argument ("fine_tune_id" , type = str , required = True )
9595def retrieve (ctx : click .Context , fine_tune_id : str ) -> None :
96- """Retrieve fine-tuning task """
96+ """Retrieve fine-tuning job details """
9797 client : Together = ctx .obj
9898
9999 response = client .fine_tuning .retrieve (fine_tune_id )
100100
101- table_data = [
102- {"Key" : key , "Value" : value }
103- for key , value in response .model_dump ().items ()
104- if key not in ["events" ]
105- ]
106- table = tabulate (table_data , tablefmt = "grid" )
101+ # remove events from response for cleaner output
102+ response .events = None
107103
108- click .echo (table )
104+ click .echo (json . dumps ( response . model_dump (), indent = 4 ) )
109105
110106
111- @fine_tune .command ()
107+ @fine_tuning .command ()
112108@click .pass_context
113109@click .argument ("fine_tune_id" , type = str , required = True )
114110def cancel (ctx : click .Context , fine_tune_id : str ) -> None :
115- """Cancel fine-tuning task """
111+ """Cancel fine-tuning job """
116112 client : Together = ctx .obj
117113
118114 response = client .fine_tuning .cancel (fine_tune_id )
119115
120116 click .echo (json .dumps (response .model_dump (), indent = 4 ))
121117
122118
123- @fine_tune .command ()
119+ @fine_tuning .command ()
124120@click .pass_context
125121@click .argument ("fine_tune_id" , type = str , required = True )
126122def list_events (ctx : click .Context , fine_tune_id : str ) -> None :
@@ -135,7 +131,7 @@ def list_events(ctx: click.Context, fine_tune_id: str) -> None:
135131 for i in response .data :
136132 display_list .append (
137133 {
138- "Message" : i .message ,
134+ "Message" : " \n " . join ( wrap ( i .message or "" , width = 50 )) ,
139135 "Type" : i .type ,
140136 "Created At" : parse_timestamp (i .created_at or "" ),
141137 "Hash" : i .hash ,
@@ -146,14 +142,14 @@ def list_events(ctx: click.Context, fine_tune_id: str) -> None:
146142 click .echo (table )
147143
148144
149- @fine_tune .command ()
145+ @fine_tuning .command ()
150146@click .pass_context
151147@click .argument ("fine_tune_id" , type = str , required = True )
152148@click .option (
153149 "--output_dir" ,
154150 type = click .Path (exists = True , file_okay = False , resolve_path = True ),
155151 required = False ,
156- default = "." ,
152+ default = None ,
157153 help = "Output directory" ,
158154)
159155@click .option (
0 commit comments