Download mGPT/data/build_data.py from po03087/egolm-protocol-v2-code: direct link, hf CLI and curl.
- Browser
- Download file 668 Bytes
-
https://huggingface.co/po03087/egolm-protocol-v2-code/resolve/main/mGPT/data/build_data.py
- Command line
-
hf download hf://po03087/egolm-protocol-v2-code/mGPT/data/build_data.py
-
curl -L -o build_data.py https://huggingface.co/po03087/egolm-protocol-v2-code/resolve/main/mGPT/data/build_data.py
668 Bytes
| from omegaconf import OmegaConf | |
| from os.path import join as pjoin | |
| from mGPT.config import instantiate_from_config | |
| def build_data(cfg, phase="train"): | |
| data_config = OmegaConf.to_container(cfg.DATASET, resolve=True) | |
| data_config['params'] = {'cfg': cfg, 'phase': phase} | |
| if isinstance(data_config['target'], str): | |
| return instantiate_from_config(data_config) | |
| elif isinstance(data_config['target'], list): | |
| data_config_tmp = data_config.copy() | |
| data_config_tmp['params']['dataModules'] = data_config['target'] | |
| data_config_tmp['target'] = 'mGPT.data.Concat.ConcatDataModule' | |
| return instantiate_from_config(data_config) | |