Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug related to the device setting when using torch #95

Merged
merged 1 commit into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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