Skip to content

Commit

Permalink
Fixed a bug related to the device setting when using torch (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuniz authored Sep 23, 2023
1 parent 658b8c6 commit 13c9aac
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions noisereduce/noisereduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

try:
import torch

TORCH_AVAILABLE = True
except ImportError:
TORCH_AVAILABLE = False
Expand Down Expand Up @@ -121,9 +120,6 @@ def reduce_noise(

# if using pytorch,
if use_torch:
device = (
torch.device(device) if torch.cuda.is_available() else torch.device(device)
)
sg = StreamedTorchGate(
y=y,
sr=sr,
Expand Down
2 changes: 1 addition & 1 deletion noisereduce/spectralgate/streamed_torch_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
n_jobs=n_jobs,
)

self.device = device
self.device = torch.device(device if torch.cuda.is_available() else 'cpu')

# noise convert to torch if needed
if y_noise is not None:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
name="noisereduce",
packages=find_packages(),
version="3.0.0",
version="3.0.1",
description="Noise reduction using Spectral Gating in Python",
author="Tim Sainburg",
license="MIT",
Expand Down

0 comments on commit 13c9aac

Please sign in to comment.