Skip to content

Commit

Permalink
Merge pull request #228 from tosemml/patch-1
Browse files Browse the repository at this point in the history
Code Refactoring
  • Loading branch information
lucidrains authored Sep 1, 2023
2 parents 5e0261b + 741d547 commit 879f3bd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions audiolm_pytorch/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from random import choice
from pathlib import Path
from shutil import rmtree
from collections import Counter

from beartype.typing import Union, List, Optional, Tuple
from typing_extensions import Annotated
Expand Down Expand Up @@ -102,11 +103,7 @@ def accum_log(log, new_logs):
# auto data to module keyword argument routing functions

def has_duplicates(tup):
counts = dict()
for el in tup:
if el not in counts:
counts[el] = 0
counts[el] += 1
counts = dict(Counter(tup))
return any(filter(lambda count: count > 1, counts.values()))

def determine_types(data, config):
Expand Down Expand Up @@ -1330,4 +1327,4 @@ def train(self, log_fn = noop):
logs = self.train_step()
log_fn(logs)

self.print('training complete')
self.print('training complete')

0 comments on commit 879f3bd

Please sign in to comment.