finetuner.finetuner module#

class finetuner.finetuner.Finetuner[source]#

Bases: object

Finetuner class.

login(force=False, interactive=None)[source]#

Login to Hubble account, initialize a client object and create a default experiment.

Parameters:

force (bool) – If set to true, overwrite token and re-login.

Note: Calling login is necessary for using finetuner.

create_experiment(name='default')#

Create an experiment.

Parameters:

name (str) – Optional name of the experiment. If None, the experiment is named after the current directory.

Return type:

Experiment

Returns:

An Experiment object.

get_experiment(name)#

Get an experiment by its name.

Parameters:

name (str) – Name of the experiment.

Return type:

Experiment

Returns:

An Experiment object.

list_experiments(page=1, size=50)#

List every experiment.

Parameters:
  • page (int) – The page index.

  • size (int) – The number of experiments to retrieve.

Return type:

List[Experiment]

Returns:

A list of Experiment instance.

..note:: page and size works together. For example, page 1 size 50 gives

the 50 experiments in the first page. To get 50-100, set page as 2.

..note:: The maximum number for size per page is 100.

delete_experiment(name)#

Delete an experiment by its name. :type name: str :param name: Name of the experiment. :rtype: Experiment :return: Deleted experiment.

delete_experiments()#

Delete every experiment. :rtype: List[Experiment] :return: List of deleted experiments.

create_training_run(model, train_data, eval_data=None, val_split=0.0, model_artifact=None, run_name=None, description=None, experiment_name=None, model_options=None, loss='TripletMarginLoss', miner=None, miner_options=None, optimizer='Adam', optimizer_options=None, learning_rate=None, epochs=5, batch_size=None, callbacks=None, scheduler=None, scheduler_options=None, freeze=False, output_dim=None, device='cuda', num_workers=4, to_onnx=False, csv_options=None, public=False, num_items_per_class=4, sampler='auto', loss_optimizer=None, loss_optimizer_options=None)#

Create a training run.

If an experiment name is not specified, the run will be created in the default experiment.

Return type:

Run

Returns:

A Run object.

create_synthesis_run(query_data, corpus_data, models, num_relations=10, run_name=None, description=None, experiment_name=None, device='cuda', num_workers=4, csv_options=None, public=False)#

Create a synthesis run.

If an experiment name is not specified, the run will be created in the default experiment.

Return type:

Run

Returns:

A Run object.

get_run(run_name, experiment_name=None)#

Get run by its name and (optional) experiment.

If an experiment name is not specified, we’ll look for the run in the default experiment.

Parameters:
  • run_name (str) – Name of the run.

  • experiment_name (Optional[str]) – Optional name of the experiment.

Return type:

Run

Returns:

A Run object.

list_runs(experiment_name=None, page=1, size=50)#

List all created runs inside a given experiment.

If no experiment is specified, list runs for all available experiments. :type experiment_name: Optional[str] :param experiment_name: The name of the experiment. :type page: int :param page: The page index. :type size: int :param size: Number of runs to retrieve. :rtype: List[Run] :return: List of all runs.

..note:: page and size works together. For example, page 1 size 50 gives

the 50 runs in the first page. To get 50-100, set page as 2.

..note:: The maximum number for size per page is 100.

delete_run(run_name, experiment_name=None)#

Delete a run.

If an experiment name is not specified, we’ll look for the run in the default experiment.

Parameters:
  • run_name (str) – Name of the run.

  • experiment_name (Optional[str]) – Optional name of the experiment.

delete_runs(experiment_name=None)#

Delete every run.

If an experiment name is not specified, we’ll delete every run across all experiments.

Parameters:

experiment_name (Optional[str]) – Optional name of the experiment.

get_token()#
Return type:

str