コード例 #1
0
# Set up feature dimensions
feat_dim = int(os.environ["FEAT_DIM"])
left_context = int(os.environ["LEFT_CONTEXT"])
right_context = int(os.environ["RIGHT_CONTEXT"])
time_dim = (left_context + right_context + 1)

# Set up training parameters
on_gpu = torch.cuda.is_available()

# Fix random seed for debugging
torch.manual_seed(1)
if on_gpu:
    torch.cuda.manual_seed_all(1)

# Set up the model and associated checkpointing directory
model = setup_model(e2e=True)
if on_gpu:
    model.cuda()
ckpt_path = best_ckpt_path(e2e=True)

# Load checkpoint
ckpt = torch.load(ckpt_path, map_location=lambda storage,loc: storage)
model.load_state_dict(ckpt["state_dict"])
model.eval()

# Set up data files
scp_dir = os.path.join(os.environ["%s_FEATS" % source_class.upper()], data_dir)
# scp_name = os.path.join(scp_dir, "feats.scp")
scp_file = os.path.join(scp_dir, "feats-norm.scp")

loader_kwargs = {"num_workers": 1, "pin_memory": True} if on_gpu else {}
コード例 #2
0
learning_rate = float(os.environ["LEARNING_RATE"])
l2_reg = float(os.environ["L2_REG"])
use_reconstruction = True if os.environ[
    "USE_RECONSTRUCTION"] == "true" else False
use_transformation = True if os.environ[
    "USE_TRANSFORMATION"] == "true" else False
loss_func = os.environ["LOSS_FUNC"]
on_gpu = torch.cuda.is_available()

# Fix random seed for debugging
torch.manual_seed(1)
if on_gpu:
    torch.cuda.manual_seed_all(1)

# Set up the model and associated checkpointing directory
model = setup_model(denoiser=True)
print(model, flush=True)

# Count number of trainable parameters
model_parameters = filter(lambda p: p.requires_grad, model.parameters())
params = sum([np.prod(p.size()) for p in model_parameters])
print("Model has %d trainable parameters" % params, flush=True)

if on_gpu:
    model.cuda()
ckpt_path = best_ckpt_path(denoiser=True)

# Set up data files
decoder_classes = []
for res_str in os.environ["DECODER_CLASSES_DELIM"].split("_"):
    if len(res_str) > 0:
コード例 #3
0
learning_rate = float(os.environ["LEARNING_RATE"])
l2_reg = float(os.environ["L2_REG"])
use_reconstruction = True if os.environ[
    "USE_RECONSTRUCTION"] == "true" else False
use_transformation = True if os.environ[
    "USE_TRANSFORMATION"] == "true" else False
loss_func = os.environ["LOSS_FUNC"]
on_gpu = torch.cuda.is_available()

# Fix random seed for debugging
torch.manual_seed(1)
if on_gpu:
    torch.cuda.manual_seed_all(1)

# Set up the model and associated checkpointing directory
model = setup_model(phone=True)
print(model, flush=True)

# Count number of trainable parameters
model_parameters = filter(lambda p: p.requires_grad, model.parameters())
params = sum([np.prod(p.size()) for p in model_parameters])
print("Model has %d trainable parameters" % params, flush=True)

if on_gpu:
    model.cuda()
ckpt_path = best_ckpt_path(phone=True)

# Set up data files
decoder_classes = []
for res_str in os.environ["DECODER_CLASSES_DELIM"].split("_"):
    if len(res_str) > 0:
コード例 #4
0
ファイル: train_vanilla.py プロジェクト: Sandy4321/meng-timit
learning_rate = float(os.environ["LEARNING_RATE"])
l2_reg = float(os.environ["L2_REG"])
use_reconstruction = True if os.environ[
    "USE_RECONSTRUCTION"] == "true" else False
use_transformation = True if os.environ[
    "USE_TRANSFORMATION"] == "true" else False
loss_func = os.environ["LOSS_FUNC"]
on_gpu = torch.cuda.is_available()

# Fix random seed for debugging
torch.manual_seed(1)
if on_gpu:
    torch.cuda.manual_seed_all(1)

# Set up the model and associated checkpointing directory
model = setup_model()
print(model, flush=True)

# Count number of trainable parameters
model_parameters = filter(lambda p: p.requires_grad, model.parameters())
params = sum([np.prod(p.size()) for p in model_parameters])
print("Model has %d trainable parameters" % params, flush=True)

if on_gpu:
    model.cuda()
ckpt_path = best_ckpt_path()

# Set up data files
decoder_classes = []
for res_str in os.environ["DECODER_CLASSES_DELIM"].split("_"):
    if len(res_str) > 0: