Similar to load function, used by Pythia to build a dataset for first time when it is not available. This internally calls '_build' function. Override that function in your child class. Args: dataset_type (str): Type of dataset, train|val|test
(self, dataset_type, config, *args, **kwargs)
| 88 | ) |
| 89 | |
| 90 | def build(self, dataset_type, config, *args, **kwargs): |
| 91 | """ |
| 92 | Similar to load function, used by Pythia to build a dataset for first |
| 93 | time when it is not available. This internally calls '_build' function. |
| 94 | Override that function in your child class. |
| 95 | |
| 96 | Args: |
| 97 | dataset_type (str): Type of dataset, train|val|test |
| 98 | config (ConfigNode): Configuration of this dataset loaded from |
| 99 | config. |
| 100 | |
| 101 | .. warning:: |
| 102 | |
| 103 | DO NOT OVERRIDE in child class. Instead override ``_build``. |
| 104 | """ |
| 105 | # Only build in main process, so none of the others have to build |
| 106 | if is_main_process(): |
| 107 | self._build(dataset_type, config, *args, **kwargs) |
| 108 | synchronize() |
| 109 | |
| 110 | def _build(self, dataset_type, config, *args, **kwargs): |
| 111 | """ |
no test coverage detected