Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sgmse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Svajda, Till
sgmse
Commits
4b5970c2
Commit
4b5970c2
authored
1 year ago
by
jrichter
Browse files
Options
Downloads
Patches
Plain Diff
add set_torch_cuda_arch_list()
parent
089a625f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sgmse/util/other.py
+18
-8
18 additions, 8 deletions
sgmse/util/other.py
with
18 additions
and
8 deletions
sgmse/util/other.py
+
18
−
8
View file @
4b5970c2
import
os
import
os
import
torch
import
numpy
as
np
import
numpy
as
np
import
scipy.stats
import
scipy.stats
from
scipy.signal
import
butter
,
sosfilt
from
scipy.signal
import
butter
,
sosfilt
import
torch
from
pesq
import
pesq
from
pesq
import
pesq
from
pystoi
import
stoi
from
pystoi
import
stoi
def
si_sdr_components
(
s_hat
,
s
,
n
):
def
si_sdr_components
(
s_hat
,
s
,
n
):
"""
"""
# s_target
# s_target
alpha_s
=
np
.
dot
(
s_hat
,
s
)
/
np
.
linalg
.
norm
(
s
)
**
2
alpha_s
=
np
.
dot
(
s_hat
,
s
)
/
np
.
linalg
.
norm
(
s
)
**
2
s_target
=
alpha_s
*
s
s_target
=
alpha_s
*
s
...
@@ -28,8 +23,6 @@ def si_sdr_components(s_hat, s, n):
...
@@ -28,8 +23,6 @@ def si_sdr_components(s_hat, s, n):
return
s_target
,
e_noise
,
e_art
return
s_target
,
e_noise
,
e_art
def
energy_ratios
(
s_hat
,
s
,
n
):
def
energy_ratios
(
s_hat
,
s
,
n
):
"""
"""
s_target
,
e_noise
,
e_art
=
si_sdr_components
(
s_hat
,
s
,
n
)
s_target
,
e_noise
,
e_art
=
si_sdr_components
(
s_hat
,
s
,
n
)
si_sdr
=
10
*
np
.
log10
(
np
.
linalg
.
norm
(
s_target
)
**
2
/
np
.
linalg
.
norm
(
e_noise
+
e_art
)
**
2
)
si_sdr
=
10
*
np
.
log10
(
np
.
linalg
.
norm
(
s_target
)
**
2
/
np
.
linalg
.
norm
(
e_noise
+
e_art
)
**
2
)
...
@@ -129,3 +122,20 @@ def print_mean_std(data, decimal=2):
...
@@ -129,3 +122,20 @@ def print_mean_std(data, decimal=2):
elif
decimal
==
1
:
elif
decimal
==
1
:
string
=
f
'
{
mean
:
.
1
f
}
±
{
std
:
.
1
f
}
'
string
=
f
'
{
mean
:
.
1
f
}
±
{
std
:
.
1
f
}
'
return
string
return
string
def
set_torch_cuda_arch_list
():
if
not
torch
.
cuda
.
is_available
():
print
(
"
CUDA is not available. No GPUs found.
"
)
return
num_gpus
=
torch
.
cuda
.
device_count
()
compute_capabilities
=
[]
for
i
in
range
(
num_gpus
):
cc_major
,
cc_minor
=
torch
.
cuda
.
get_device_capability
(
i
)
cc
=
f
"
{
cc_major
}
.
{
cc_minor
}
"
compute_capabilities
.
append
(
cc
)
cc_string
=
"
;
"
.
join
(
compute_capabilities
)
os
.
environ
[
'
TORCH_CUDA_ARCH_LIST
'
]
=
cc_string
print
(
f
"
Set TORCH_CUDA_ARCH_LIST to:
{
cc_string
}
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment