oops

parent ca7c3333
......@@ -150,8 +150,8 @@ class Criterion(nn.modules.loss._Loss):
class CriterionContainer(Criterion):
def __init__(self, criterions=[], options={}, weight=1.0, **kwargs):
super().__init__(**kwargs)
self._criterions = criterions
super().__init__(**kwargs)
def __getitem__(self, item):
......
......@@ -21,7 +21,7 @@ equivalenceInstruments = ['Clarinet-Bb', 'Alto-Sax', 'Trumpet-C', 'Violoncello',
def get_perceptual_centroids(dataset, mds_dims, timbre_path='timbre.npy', covariance=True, timbreNormalize=True,
timbreProcessing=True):
if (timbreProcessing == True or (not os.path.isfile('timbre_' + str(mds_dims) + '.npy'))):
fullTimbreData = np.load(f"{os.path.dirname(__file__)}/{timbre_path}")[None][0]
fullTimbreData = np.load(f"{os.path.dirname(__file__)}/{timbre_path}", allow_pickle=True)[None][0]
# Names of the pre-extracted set of instruments (all with pairwise rates)
selectedInstruments = fullTimbreData['instruments']
# Full sets of ratings (i, j) = all ratings for instru. i vs. instru. j
......@@ -148,7 +148,7 @@ class PerceptiveGaussianLoss(Criterion):
def __init__(self, latent_params, dataset=None, normalize=False):
super(PerceptiveGaussianLoss, self).__init__()
targetDims = latent_params['dim']
_, latent_means, latent_stds = get_perceptual_centroids(dataset, targetDims)
_, (latent_means, latent_stds) = get_perceptual_centroids(dataset, targetDims)
self.latent_means = torch.from_numpy(latent_means).type('torch.FloatTensor') if issubclass(type(latent_means), np.ndarray) else latent_means.type('torch.FloatTensor')
self.latent_stds = torch.from_numpy(latent_stds).type('torch.FloatTensor') if issubclass(type(latent_stds), np.ndarray) else latent_stds.type('torch.FloatTensor')
self.targetDims = np.arange(targetDims)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment