mwptoolkit.utils.utils¶
- mwptoolkit.utils.utils.get_model(model_name)[source]¶
Automatically select model class based on model name
- Parameters
model_name (str) – model name
- Returns
model class
- Return type
Model
- mwptoolkit.utils.utils.get_trainer(config)[source]¶
Automatically select trainer class based on task type and model name
- Parameters
config (Config) –
- Returns
trainer class
- Return type
SupervisedTrainer
- mwptoolkit.utils.utils.get_trainer_(task_type, model_name, sup_mode)[source]¶
Automatically select trainer class based on model type and model name
- Parameters
model_type (TaskType) – model type
model_name (str) – model name
- Returns
trainer class
- Return type
Trainer
- mwptoolkit.utils.utils.init_seed(seed, reproducibility)[source]¶
init random seed for random functions in numpy, torch, cuda and cudnn
- Parameters
seed (int) – random seed
reproducibility (bool) – Whether to require reproducibility
- mwptoolkit.utils.utils.lists2dict(list1, list2)[source]¶
convert two lists to dict, elements of first list as keys, another’s as values.
- mwptoolkit.utils.utils.read_ape200k_source(filename)[source]¶
specially used to read data of ape200k source file
- mwptoolkit.utils.utils.read_math23k_source(filename)[source]¶
specially used to read data of math23k source file