finetuner.run module#
- class finetuner.run.Run(client, name, experiment_name, config, created_at, description='')[source]#
Bases:
object
Class for a run.
- Parameters:
client (
FinetunerV1Client
) – Client object for sending api requests.name (
str
) – Name of the run.experiment_name (
str
) – Name of the experiment.config (
dict
) – Configuration for the run.created_at (
str
) – Creation time of the run.description (
str
) – Optional description of the run.
- stream_logs(interval=5)[source]#
Stream the
Run
logs lively.- Parameters:
interval (
int
) – The time interval to sync the status of finetuner Run.- Yield:
An iterators keep stream the logs from server.
- Return type:
Iterator
[str
]
- metrics()[source]#
Get the evaluation metrics of the
Run
.- Return type:
Dict
[str
,Dict
[str
,float
]]- Returns:
dictionary with evaluation metrics before and after fine-tuning.
- example_results()[source]#
Get the results of example queries from the evaluation data of the
Run
.- Return type:
Dict
[str
,Any
]- Returns:
dictionary with results before and after fine-tuning.
- display_examples(k=5)[source]#
Prints a table of results of example queries before and after fine-tuning.
- Parameters:
k (
int
) – maximal number of results per query to display
- save_artifact(directory='artifacts/')[source]#
Save artifact if the
Run
is finished.- Parameters:
directory (
str
) – Directory where the artifact will be stored.- Return type:
str
- Returns:
A string object that indicates the download path.
- property artifact_id#
Get artifact id of the
Run
.An artifact in finetuner contains fine-tuned model and its metadata. Such as preprocessing function, collate function. This id could be useful if you want to directly pull the artifact from the cloud storage, such as using FinetunerExecutor.
- Returns:
Artifact id as string object.