wasmdashai commited on
Commit
d5e8ac8
·
verified ·
1 Parent(s): 65aee5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -52
app.py CHANGED
@@ -409,7 +409,7 @@ class TrinerModelVITS:
409
  self.init_wandb()
410
  # self.training_args=load_training_args(self.path_training_args)
411
  # training_args= self.training_args
412
- scaler = GradScaler(enabled=True)
413
  for disc in self.model.discriminator.discriminators:
414
  disc.apply_weight_norm()
415
  self.model.decoder.apply_weight_norm()
@@ -421,33 +421,34 @@ class TrinerModelVITS:
421
 
422
  discriminator = self.model.discriminator
423
  self.model.discriminator = None
 
424
 
425
- optimizer = torch.optim.AdamW(
426
- self.model.parameters(),
427
- 2e-4,
428
- betas=[0.8, 0.99],
429
- # eps=training_args.adam_epsilon,
430
- )
431
 
432
- # Hack to be able to train on multiple device
433
- disc_optimizer = torch.optim.AdamW(
434
- discriminator.parameters(),
435
- 2e-4,
436
- betas=[0.8, 0.99],
437
- # eps=training_args.adam_epsilon,
438
- )
439
- lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
440
- optimizer,gamma=0.999875, last_epoch=-1
441
- )
442
- disc_lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
443
- disc_optimizer, gamma=0.999875,last_epoch=-1
444
- )
445
- self.models=(self.model,discriminator)
446
- self.optimizers=(optimizer,disc_optimizer,scaler)
447
- self.lr_schedulers=(lr_scheduler,disc_lr_scheduler)
448
- self.tools=load_tools()
449
- self.stute_mode=True
450
- print(self.lr_schedulers)
451
 
452
 
453
 
@@ -502,8 +503,8 @@ class TrinerModelVITS:
502
  training_args.num_train_epochs=4
503
  training_args.eval_steps=1000
504
 
505
- # set_seed(training_args.seed)
506
- # scaler = GradScaler(enabled=training_args.fp16)
507
 
508
 
509
  # # Initialize optimizer, lr_scheduler
@@ -518,33 +519,34 @@ class TrinerModelVITS:
518
 
519
  # discriminator = self.model.discriminator
520
  # self.model.discriminator = None
 
521
 
522
- # optimizer = torch.optim.AdamW(
523
- # self.model.parameters(),
524
- # training_args.learning_rate,
525
- # betas=[training_args.adam_beta1, training_args.adam_beta2],
526
- # eps=training_args.adam_epsilon,
527
- # )
528
 
529
- # # Hack to be able to train on multiple device
530
- # disc_optimizer = torch.optim.AdamW(
531
- # discriminator.parameters(),
532
- # training_args.d_learning_rate,
533
- # betas=[training_args.d_adam_beta1, training_args.d_adam_beta2],
534
- # eps=training_args.adam_epsilon,
535
- # )
536
- # lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
537
- # optimizer, gamma=training_args.lr_decay, last_epoch=-1
538
- # )
539
- # disc_lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
540
- # disc_optimizer, gamma=training_args.lr_decay, last_epoch=-1
541
- # )
542
  # self.models=(self.model,discriminator)
543
- # self.optimizers=(optimizer,disc_optimizer,scaler)
544
- # self.lr_schedulers=(lr_scheduler,disc_lr_scheduler)
545
- # self.tools=load_tools()
546
- # self.stute_mode=True
547
- # print(self.lr_schedulers)
548
 
549
 
550
 
 
409
  self.init_wandb()
410
  # self.training_args=load_training_args(self.path_training_args)
411
  # training_args= self.training_args
412
+ # scaler = GradScaler(enabled=True)
413
  for disc in self.model.discriminator.discriminators:
414
  disc.apply_weight_norm()
415
  self.model.decoder.apply_weight_norm()
 
421
 
422
  discriminator = self.model.discriminator
423
  self.model.discriminator = None
424
+ self.models=(self.model,discriminator)
425
 
426
+ # optimizer = torch.optim.AdamW(
427
+ # self.model.parameters(),
428
+ # 2e-4,
429
+ # betas=[0.8, 0.99],
430
+ # # eps=training_args.adam_epsilon,
431
+ # )
432
 
433
+ # # Hack to be able to train on multiple device
434
+ # disc_optimizer = torch.optim.AdamW(
435
+ # discriminator.parameters(),
436
+ # 2e-4,
437
+ # betas=[0.8, 0.99],
438
+ # # eps=training_args.adam_epsilon,
439
+ # )
440
+ # lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
441
+ # optimizer,gamma=0.999875, last_epoch=-1
442
+ # )
443
+ # disc_lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
444
+ # disc_optimizer, gamma=0.999875,last_epoch=-1
445
+ # )
446
+ # self.models=(self.model,discriminator)
447
+ # self.optimizers=(optimizer,disc_optimizer,scaler)
448
+ # self.lr_schedulers=(lr_scheduler,disc_lr_scheduler)
449
+ # self.tools=load_tools()
450
+ # self.stute_mode=True
451
+ # print(self.lr_schedulers)
452
 
453
 
454
 
 
503
  training_args.num_train_epochs=4
504
  training_args.eval_steps=1000
505
 
506
+ set_seed(training_args.seed)
507
+ scaler = GradScaler(enabled=training_args.fp16)
508
 
509
 
510
  # # Initialize optimizer, lr_scheduler
 
519
 
520
  # discriminator = self.model.discriminator
521
  # self.model.discriminator = None
522
+ model,discriminator=self.models
523
 
524
+ optimizer = torch.optim.AdamW(
525
+ model.parameters(),
526
+ training_args.learning_rate,
527
+ betas=[training_args.adam_beta1, training_args.adam_beta2],
528
+ eps=training_args.adam_epsilon,
529
+ )
530
 
531
+ # Hack to be able to train on multiple device
532
+ disc_optimizer = torch.optim.AdamW(
533
+ discriminator.parameters(),
534
+ training_args.d_learning_rate,
535
+ betas=[training_args.d_adam_beta1, training_args.d_adam_beta2],
536
+ eps=training_args.adam_epsilon,
537
+ )
538
+ lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
539
+ optimizer, gamma=training_args.lr_decay, last_epoch=-1
540
+ )
541
+ disc_lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
542
+ disc_optimizer, gamma=training_args.lr_decay, last_epoch=-1
543
+ )
544
  # self.models=(self.model,discriminator)
545
+ self.optimizers=(optimizer,disc_optimizer,scaler)
546
+ self.lr_schedulers=(lr_scheduler,disc_lr_scheduler)
547
+ self.tools=load_tools()
548
+ self.stute_mode=True
549
+ print(self.lr_schedulers)
550
 
551
 
552