primeqa.ir.dense.dpr_top.torch_util.hypers_base.HypersBase#

class primeqa.ir.dense.dpr_top.torch_util.hypers_base.HypersBase#

Bases: object

This should be the base hyperparameters class, others should extend this.

Methods

fill_from_args

Fill this hyperparameter object from the command line.

fill_from_config

Fill this hyperparameter object from the config.

from_dict

jsonl_instances

Provides json objects for one pass over 'filename'.

set_gradient_accumulation_steps

when searching for bsize in hyperparameter tuning we need to update the gradient accumulation steps to stay within GPU memory constraints :return:

set_seed

to_dict

fill_from_args()#

Fill this hyperparameter object from the command line. :return:

fill_from_config(config)#

Fill this hyperparameter object from the config. :return:

jsonl_instances(filename: str, *, rand: Optional[random.Random], filter_out: Optional[Callable[[Dict], bool]] = None)#

Provides json objects for one pass over ‘filename’. Only instances for our global rank are returned :param filename: the file or directory of the jsonl dataset :param rand: the random.Random, should be seeded from hypers.seed, None if no shuffling :param filter_out: json objects are passed to this function, True means the instance is excluded :return: this is a generator, it yields json objects

set_gradient_accumulation_steps()#

when searching for bsize in hyperparameter tuning we need to update the gradient accumulation steps to stay within GPU memory constraints :return: