nip.factory._add_pretrained_embeddings_to_datasets

nip.factory._add_pretrained_embeddings_to_datasets#

nip.factory._add_pretrained_embeddings_to_datasets(hyper_params: HyperParameters, settings: ExperimentSettings, agents: dict[str, Agent], train_dataset: Dataset, test_dataset: Dataset)[source]#

Add embeddings to the datasets from pretrained models.

Agent parts can request embeddings from pretrained models using the required_pretrained_models attribute.

This function collects the names of the pretrained models required by the agents, and for each one, if the embeddings are not already cached, it generates them and adds them to the datasets.

Parameters:
  • hyper_params (HyperParameters) – The parameters for the experiment.

  • settings (ExperimentSettings) – The settings for the experiment.

  • agents (dict[str, Agent]) – The agents for the experiment.

  • train_dataset (Dataset) – The train dataset for the experiment.

  • test_dataset (Dataset) – The test dataset for the experiment.