Skip to content

Commit

Permalink
Fix numpy.int error (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuekaizhang authored Dec 18, 2023
1 parent 1fe369e commit a6b2e1f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ conda create -n gss python=3.8
```

Install CuPy as follows (see https://docs.cupy.dev/en/stable/install.html for the appropriate version
for your CUDA).
for your CUDA).

```bash
pip install cupy-cuda102
Expand Down Expand Up @@ -153,15 +153,15 @@ using Snakeviz.
* `--force-overwrite`: Flag to force enhanced audio files to be overwritten.

### Multi-GPU Usage
You can refer to e.g. the [AMI recipe](./recipes/ami/run.sh) for how to use this toolkit
You can refer to e.g. the [AMI recipe](./recipes/ami/run.sh) for how to use this toolkit
with multiple GPUs. <br>
**NOTE**: your GPUs must be in Exclusive_Thread mode, otherwise this library may not work as expected and/or the inference
**NOTE**: your GPUs must be in Exclusive_Thread mode, otherwise this library may not work as expected and/or the inference
time will greatly increase. **This is especially important if you are using** `run.pl`. <br>
You can check the compute mode of GPU `X` using:
```bash
nvidia-smi -i X -q | grep "Compute Mode"
```
We also provide an automate tool to do that called `gpu_check` which takes as arguments the cmd used (e.g. run.pl) and number of jobs:
We also provide an automate tool to do that called `gpu_check` which takes as arguments the cmd used (e.g. run.pl) and number of jobs:
```bash
$cmd JOB=1:$nj ${exp_dir}/${dset_name}/${dset_part}/log/enhance.JOB.log \
gss utils gpu_check $nj $cmd \& gss enhance cuts \
Expand All @@ -173,7 +173,7 @@ We also provide an automate tool to do that called `gpu_check` which takes as ar
--max-batch-duration 120 \
${affix} || exit 1
```
See again [AMI recipe](./recipes/ami/run.sh) or the [CHiME-7 DASR GSS code](https://github.com/espnet/espnet/blob/master/egs2/chime7_task1/asr1/local/run_gss.sh).
See again [AMI recipe](./recipes/ami/run.sh) or the [CHiME-7 DASR GSS code](https://github.com/espnet/espnet/blob/master/egs2/chime7_task1/asr1/local/run_gss.sh).
## FAQ

**What happens if I set the `--max-batch-duration` too large?**
Expand Down
9 changes: 5 additions & 4 deletions gss/bin/modes/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import logging
import os
import re
import subprocess
from pathlib import Path

import click
import subprocess
import os
import re

from gss.bin.modes.cli_base import cli
import logging

logging.basicConfig(
format="%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s",
Expand Down
4 changes: 3 additions & 1 deletion gss/cacgmm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def log_pdf_to_affiliation(
affiliation *= weight

if source_activity_mask is not None:
assert source_activity_mask.dtype == cp.bool_, source_activity_mask.dtype # noqa
assert (
source_activity_mask.dtype == cp.bool_
), source_activity_mask.dtype # noqa
affiliation *= source_activity_mask

denominator = cp.maximum(
Expand Down
2 changes: 1 addition & 1 deletion gss/core/stft_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def stft(
# Pad with zeros to have enough samples for the window function to fade.
assert fading in [None, True, False, "full", "half"], fading
if fading not in [False, None]:
pad_width = np.zeros([ndim, 2], dtype=np.int)
pad_width = np.zeros([ndim, 2], dtype=int)
if fading == "half":
pad_width[axis, 0] = (window_length - shift) // 2
pad_width[axis, 1] = ceil((window_length - shift) / 2)
Expand Down
4 changes: 2 additions & 2 deletions gss/utils/numpy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def segment_axis(
npad[axis, 1] = length - x.shape[axis]
x = xp.pad(x, pad_width=npad, mode=pad_mode, **pad_kwargs)
elif shift != 1 and (x.shape[axis] + shift - length) % shift != 0:
npad = np.zeros([x.ndim, 2], dtype=np.int)
npad = np.zeros([x.ndim, 2], dtype=int)
npad[axis, 1] = shift - ((x.shape[axis] + shift - length) % shift)
x = xp.pad(x, pad_width=npad, mode=pad_mode, **pad_kwargs)

elif end == "conv_pad":
assert shift == 1, shift
npad = np.zeros([x.ndim, 2], dtype=np.int)
npad = np.zeros([x.ndim, 2], dtype=int)
npad[axis, :] = length - shift
x = xp.pad(x, pad_width=npad, mode=pad_mode, **pad_kwargs)
elif end is None:
Expand Down
2 changes: 1 addition & 1 deletion gss/wpe/wpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def build_y_tilde(Y, taps, delay):
T = Y.shape[-1]

def pad(x, axis=-1, pad_width=taps + delay - 1):
npad = np.zeros([x.ndim, 2], dtype=np.int)
npad = np.zeros([x.ndim, 2], dtype=int)
npad[axis, 0] = pad_width
x = cp.pad(x, pad_width=npad, mode="constant", constant_values=0)
return x
Expand Down
2 changes: 1 addition & 1 deletion recipes/chime6/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ module use /home/hltcoe/draj/modulefiles || exit 1
module load cuda || exit 1 # loads CUDA 10.2
module load cudnn || exit 1 # loads cuDNN 8.0.2
module load intel/mkl/64/2019/5.281 || exit 1
module load nccl || exit 1
module load nccl || exit 1

0 comments on commit a6b2e1f

Please sign in to comment.