now.finetuning.run_finetuning module#

This module is the entry point to the finetuning package.

now.finetuning.run_finetuning.finetune(finetune_settings, app_instance, dataset, user_input, env_dict, kubectl_path)[source]#

If possible, applies finetuning and updates finetune_settings.finetuned_model_name accordingly.

Performs the finetuning procedure:
  1. If embeddings are not present -> compute them using a k8s deployed flow

  2. If bi-modal, prepare the embeddings by concatenating zeros for the opposing modality

  3. Create model and run finetuning, get path to the tuned model and return

Note, for music we use cached models because the datasets are too large and consume too much time

Parameters
  • user_input (UserInput) – The configured user input object

  • env_dict (Dict) – environment variables for flow.yml file

  • dataset (DocumentArray) – The dataset with the finetuning labels on all documents. Embeddings are optional and can be computed on the fly

  • finetune_settings (FinetuneSettings) – Mainly parameter configuration for the finetuner.fit

  • kubectl_path (str) – Path to the kubectl binary on the system

Return type

Tuple[str, str]

Returns

artifact of finetuned model and token required for FinetunerExecutor

now.finetuning.run_finetuning.get_bi_modal_embedding(doc)[source]#
Return type

ndarray