jhtonyKoo commited on
Commit
8f2cb5b
1 Parent(s): 8c9ee04

update loss

Browse files
Files changed (1) hide show
  1. inference.py +8 -7
inference.py CHANGED
@@ -35,12 +35,6 @@ class MasteringStyleTransfer:
35
  STEMS=['mixture'], \
36
  EFFECTS=['eq', 'imager', 'loudness'])
37
  # Loss functions
38
- self.af_loss = AudioFeatureLoss(
39
- weights=ito_config['af_weights'],
40
- sample_rate=ito_config['sample_rate'],
41
- stem_separation=False,
42
- use_clap=False
43
- )
44
  self.clap_loss = CLAPFeatureLoss(distance_fn='cosine')
45
 
46
  def load_effects_encoder(self):
@@ -81,6 +75,13 @@ class MasteringStyleTransfer:
81
  min_loss_step = 0
82
  all_results = []
83
 
 
 
 
 
 
 
 
84
  for step in range(ito_config['num_steps']):
85
  optimizer.zero_grad()
86
 
@@ -89,7 +90,7 @@ class MasteringStyleTransfer:
89
 
90
  # Compute loss
91
  if ito_config['loss_function'] == 'AudioFeatureLoss':
92
- losses = self.af_loss(output_audio, reference_tensor)
93
  elif ito_config['loss_function'] == 'CLAPFeatureLoss':
94
  if ito_config['clap_target_type'] == 'Audio':
95
  target = ito_reference_tensor
 
35
  STEMS=['mixture'], \
36
  EFFECTS=['eq', 'imager', 'loudness'])
37
  # Loss functions
 
 
 
 
 
 
38
  self.clap_loss = CLAPFeatureLoss(distance_fn='cosine')
39
 
40
  def load_effects_encoder(self):
 
75
  min_loss_step = 0
76
  all_results = []
77
 
78
+ af_loss = AudioFeatureLoss(
79
+ weights=ito_config['af_weights'],
80
+ sample_rate=ito_config['sample_rate'],
81
+ stem_separation=False,
82
+ use_clap=False
83
+ )
84
+
85
  for step in range(ito_config['num_steps']):
86
  optimizer.zero_grad()
87
 
 
90
 
91
  # Compute loss
92
  if ito_config['loss_function'] == 'AudioFeatureLoss':
93
+ losses = af_loss(output_audio, reference_tensor)
94
  elif ito_config['loss_function'] == 'CLAPFeatureLoss':
95
  if ito_config['clap_target_type'] == 'Audio':
96
  target = ito_reference_tensor