Skip to content

Commit

Permalink
Prepping for open source. (#80)
Browse files Browse the repository at this point in the history
* Check if is cuda.

* Adding stuff.

* no more print statements

* Deleting outdated tools for release.

* Bringing back post.

* bringing back tests

* Adding preference test tools + tests

* Adding to tests.

* Adding again.

* Adding stuff from Hugo's PR.

* Fixing for tests, adding docs.

* Adding timeline notches + dividing line.

* Adjusting color.

* Make cookie name customizable.

* Version bump.

---------

Co-authored-by: pseeth <[email protected]>
  • Loading branch information
pseeth and pseeth authored Jun 1, 2023
1 parent 961786a commit 09f1fdb
Show file tree
Hide file tree
Showing 24 changed files with 1,419 additions and 1,393 deletions.
2 changes: 1 addition & 1 deletion audiotools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.6.4"
__version__ = "0.7.0"
from .core import AudioSignal
from .core import STFTParams
from .core import Meter
Expand Down
16 changes: 14 additions & 2 deletions audiotools/core/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import csv
import glob
import math
import numbers
import os
Expand Down Expand Up @@ -37,7 +38,12 @@ def info(audio_path: str):
audio_path : str
Path to audio file.
"""
info = torchaudio.info(str(audio_path))
# try default backend first, then fallback to soundfile
try:
info = torchaudio.info(str(audio_path))
except: # pragma: no cover
info = torchaudio.backend.soundfile_backend.info(str(audio_path))

if isinstance(info, tuple): # pragma: no cover
signal_info = info[0]
info = Info(sample_rate=signal_info.rate, num_frames=signal_info.length)
Expand Down Expand Up @@ -232,7 +238,13 @@ def find_audio(folder: str, ext: List[str] = AUDIO_EXTENSIONS):
# Take care of case where user has passed in an audio file directly
# into one of the calling functions.
if str(folder).endswith(tuple(ext)):
return [folder]
# if, however, there's a glob in the path, we need to
# return the glob, not the file.
if "*" in str(folder):
return glob.glob(str(folder), recursive=("**" in str(folder)))
else:
return [folder]

files = []
for x in ext:
files += folder.glob(f"**/*{x}")
Expand Down
2 changes: 0 additions & 2 deletions audiotools/ml/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from . import decorators
from . import layers
from . import tricks
from .accelerator import Accelerator
from .experiment import Experiment
from .layers import BaseModel
from .trainer import BaseTrainer
2 changes: 1 addition & 1 deletion audiotools/ml/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def decorated(*args, **kwargs):
v = torch.tensor([v])
if not torch.is_tensor(v):
continue
if ddp_active: # pragma: no cover
if ddp_active and v.is_cuda: # pragma: no cover
dist.all_reduce(v, op=op)
output[k] = v.detach()
if torch.numel(v) == 1:
Expand Down
Loading

0 comments on commit 09f1fdb

Please sign in to comment.