src.utils¶
Submodules¶
src.utils.loaders¶
-
src.utils.loaders.
load_dataset
(dataset_class, dataset_folder, dataset_config)[source]¶ This is a helper function that looks in the
src.dataset
module.- Parameters
dataset_class (str) – Name of the dataset class you want to
instantiate (e.g. Scaper, MixSourceFolder) –
dataset_folder (str) – Folder you want to load the data from.
dataset_config (dict) – Configuration of the dataset
- Returns
Instantiated DatasetClass given the parameters.
- Return type
torch.utils.data.Dataset
-
src.utils.loaders.
load_model
(model_config)[source]¶ Loads a deep
SeparationModel
given a model configuration.- Parameters
model_config (dict) – Model configuration with a ‘class’ key. The rest of the keys
put into the 'args'. (get) –
- Returns
Instantiated deep model given the parameters.
- Return type
SeparationModel
src.utils.parallel¶
-
src.utils.parallel.
parallel_process
(array, function, n_jobs=4, use_kwargs=False, front_num=0)[source]¶ A parallel version of the map function with a progress bar.
- Parameters
array (array-like) – An array to iterate over.
function (function) – A python function to apply to the elements of array
n_jobs (int, default=16) – The number of cores to use
use_kwargs (boolean, default=False) – Whether to consider the elements of array as dictionaries of keyword arguments to function
front_num (int, default=3) – The number of iterations to run serially before kicking off the parallel job. Useful for catching bugs
- Returns
A list containing the results of each function on each of the arguments in the array:
[function(array[0]), function(array[1]), ...].
- Return type
list
src.utils.seed¶
-
src.utils.seed.
seed
(s=0)[source]¶ Seeds every possible random number generator with a specific seed to guarantee the same results with the same seed (hopefully). Currently supported RNGs are:
torch.manual_seed torch.cuda.manual_seed np.random.seed random.seed
If you use RNGs outside of this list in your project, then there’s no guarantee of reproducibility.
- Parameters
s (int, optional) – Seed to use. Defaults to 0.