nip.utils.language_model_database.LanguageModelDatabase#

class nip.utils.language_model_database.LanguageModelDatabase[source]#

A class for accessing the language model database.

This class provides methods to load the database and retrieve information about language models.

Methods Summary

__init__()

get_by_agent_params(agent_params)

Find a language model entry for a given set of agent hyper-parameters.

get_by_hyper_params(hyper_params, agent_name)

Find a language model entry for a set of hyper-parameters and agent name.

get_by_run_id(run_id, wandb_project, agent_name)

Find a language model entry for a given W&B run.

Methods

__init__()[source]#
get_by_agent_params(agent_params: PureTextAgentParameters) LanguageModelDbEntry[source]#

Find a language model entry for a given set of agent hyper-parameters.

Parameters:

agent_params (PureTextAgentParameters) – The agent hyper-parameters to search for in the database

Returns:

LanguageModelDbEntry – The language model entry corresponding to the hyper parameters

Raises:

LanguageModelNotFound – If no entry is found in the database for the given hyper-parameters

get_by_hyper_params(hyper_params: HyperParameters, agent_name: str) LanguageModelDbEntry[source]#

Find a language model entry for a set of hyper-parameters and agent name.

Parameters:
  • hyper_params (HyperParameters) – The hyper-parameters of the experiment

  • agent_name (str) – The name of the agent. The parameters for this agent will be used to search the database

Returns:

LanguageModelDbEntry – The language model entry corresponding to the hyper parameters

Raises:

LanguageModelNotFound – If no entry is found in the database for the given hyper-parameters

get_by_run_id(run_id: str, wandb_project: str, agent_name: str, wandb_entity: str | None = None, wandb_api: Api | None = None) LanguageModelDbEntry[source]#

Find a language model entry for a given W&B run.

Parameters:
  • run_id (str) – The ID of the W&B run

  • wandb_project (str) – The project of the wandb run.

  • agent_name (str) – The name of the agent. The parameters for this agent will be used to search the database

  • wandb_entity (str, optional) – The entity of the wandb run. If not provided, the default entity will be used.

  • wandb_api (WandbApi, optional) – The wandb API instance to use. If not provided, a new instance will be created.

Returns:

LanguageModelDbEntry – The language model entry corresponding to the hyper parameters

Raises:

LanguageModelNotFound – If no entry is found in the database for the given hyper-parameters