elif args.model == 'resnet_2d': model = model_.ResNet_2d(n_z=args.latent_size, proj_size=train_dataset.n_speakers, ncoef=args.ncoef, sm_type=args.softmax, delta=args.delta) elif args.model == 'TDNN': model = model_.TDNN(n_z=args.latent_size, proj_size=train_dataset.n_speakers, ncoef=args.ncoef, sm_type=args.softmax, delta=args.delta) elif args.model == 'TDNN_logpool': model = model_.TDNN_logpool(n_z=args.latent_size, proj_size=train_dataset.n_speakers, ncoef=args.ncoef, sm_type=args.softmax, delta=args.delta) elif args.model == 'TDNN_att': model = model_.TDNN_att(n_z=args.latent_size, proj_size=train_dataset.n_speakers, ncoef=args.ncoef, sm_type=args.softmax, delta=args.delta) elif args.model == 'TDNN_multihead': model = model_.TDNN_multihead(n_z=args.latent_size, proj_size=train_dataset.n_speakers, ncoef=args.ncoef, sm_type=args.softmax, delta=args.delta) elif args.model == 'TDNN_lstm':
elif args.model == 'resnet_lstm': model = model_.ResNet_lstm(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'resnet_qrnn': model = model_.ResNet_qrnn(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'resnet_stats': model = model_.ResNet_stats(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'resnet_large': model = model_.ResNet_large(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'resnet_small': model = model_.ResNet_small(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'resnet_2d': model = model_.ResNet_2d(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'TDNN': model = model_.TDNN(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'TDNN_logpool': model = model_.TDNN_logpool(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'TDNN_att': model = model_.TDNN_att(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'TDNN_multihead': model = model_.TDNN_multihead(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'TDNN_lstm': model = model_.TDNN_lstm(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'TDNN_aspp': model = model_.TDNN_aspp(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'TDNN_mod': model = model_.TDNN_mod(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) elif args.model == 'transformer': model = model_.transformer_enc(n_z=args.latent_size, proj_size=0, ncoef=args.ncoef, delta = args.delta) ckpt = torch.load(args.cp_path, map_location = lambda storage, loc: storage)
print('resnet_2d', mu.size(), emb.size(), out.size()) if args.model == 'TDNN' or args.model == 'all': batch = torch.rand(3, 3 if args.delta else 1, args.ncoef, 200) model = model_.TDNN(n_z=args.latent_size, ncoef=args.ncoef, delta=args.delta, proj_size=10, sm_type='softmax') mu, emb = model.forward(batch) out = model.out_proj(mu, torch.ones(mu.size(0))) print('TDNN', mu.size(), emb.size(), out.size()) if args.model == 'TDNN_logpool' or args.model == 'all': batch = torch.rand(3, 3 if args.delta else 1, args.ncoef, 200) model = model_.TDNN_logpool(n_z=args.latent_size, ncoef=args.ncoef, delta=args.delta, proj_size=10, sm_type='softmax') mu, emb = model.forward(batch) out = model.out_proj(mu, torch.ones(mu.size(0))) print('TDNN_logpool', mu.size(), emb.size(), out.size()) if args.model == 'TDNN_att' or args.model == 'all': batch = torch.rand(3, 3 if args.delta else 1, args.ncoef, 200) model = model_.TDNN_att(n_z=args.latent_size, ncoef=args.ncoef, delta=args.delta, proj_size=10, sm_type='softmax') mu, emb = model.forward(batch) out = model.out_proj(mu, torch.ones(mu.size(0))) print('TDNN_att', mu.size(), emb.size(), out.size())