(opt_path, device)
| 27 | |
| 28 | |
| 29 | def get_opt(opt_path, device): |
| 30 | opt = Namespace() |
| 31 | opt_dict = vars(opt) |
| 32 | |
| 33 | skip = ('-------------- End ----------------', |
| 34 | '------------ Options -------------', |
| 35 | '\n') |
| 36 | print('Reading', opt_path) |
| 37 | with open(opt_path) as f: |
| 38 | for line in f: |
| 39 | if line.strip() not in skip: |
| 40 | # print(line.strip()) |
| 41 | key, value = line.strip().split(': ') |
| 42 | if value in ('True', 'False'): |
| 43 | opt_dict[key] = True if value == 'True' else False |
| 44 | elif is_float(value): |
| 45 | opt_dict[key] = float(value) |
| 46 | elif is_number(value): |
| 47 | opt_dict[key] = int(value) |
| 48 | else: |
| 49 | opt_dict[key] = str(value) |
| 50 | |
| 51 | opt_dict['which_epoch'] = 'latest' |
| 52 | if 'num_layers' not in opt_dict: |
| 53 | opt_dict['num_layers'] = 8 |
| 54 | if 'latent_dim' not in opt_dict: |
| 55 | opt_dict['latent_dim'] = 512 |
| 56 | if 'diffusion_steps' not in opt_dict: |
| 57 | opt_dict['diffusion_steps'] = 1000 |
| 58 | if 'no_clip' not in opt_dict: |
| 59 | opt_dict['no_clip'] = False |
| 60 | if 'no_eff' not in opt_dict: |
| 61 | opt_dict['no_eff'] = False |
| 62 | |
| 63 | opt.save_root = pjoin(opt.checkpoints_dir, opt.dataset_name, opt.name) |
| 64 | opt.model_dir = pjoin(opt.save_root, 'model') |
| 65 | opt.meta_dir = pjoin(opt.save_root, 'meta') |
| 66 | |
| 67 | if opt.dataset_name == 't2m': |
| 68 | opt.data_root = './data/HumanML3D' |
| 69 | opt.motion_dir = pjoin(opt.data_root, 'new_joint_vecs') |
| 70 | opt.text_dir = pjoin(opt.data_root, 'texts') |
| 71 | opt.joints_num = 22 |
| 72 | opt.dim_pose = 263 |
| 73 | opt.max_motion_length = 196 |
| 74 | elif opt.dataset_name == 'kit': |
| 75 | opt.data_root = './data/KIT-ML' |
| 76 | opt.motion_dir = pjoin(opt.data_root, 'new_joint_vecs') |
| 77 | opt.text_dir = pjoin(opt.data_root, 'texts') |
| 78 | opt.joints_num = 21 |
| 79 | opt.dim_pose = 251 |
| 80 | opt.max_motion_length = 196 |
| 81 | else: |
| 82 | raise KeyError('Dataset not recognized') |
| 83 | |
| 84 | opt.dim_word = 300 |
| 85 | opt.num_classes = 200 // opt.unit_length |
| 86 | opt.dim_pos_ohot = len(POS_enumerator) |
no test coverage detected