Skip to content

Bug report - model can only be called once. #244

@tsbertalan

Description

@tsbertalan

🐛 Bug

Model can only be called once, and then hangs on second call.

To Reproduce

Steps to reproduce the behavior:

import time
import torch

language = 'en'
model_id = 'v3_en'
speaker = 'en_5'  # en_0, en_1, ..., en_117, random
sample_rate = 48000
silero_model, _ = torch.hub.load(
    repo_or_dir='snakers4/silero-models',
    model='silero_tts',
    language=language,
    speaker=model_id
)

device = 'cpu'
silero_model.to(device)  # gpu or cpu

def _get_wave(text):
    return silero_model.apply_tts(text=text, speaker=speaker, sample_rate=sample_rate)

start = time.time()
print('Audio 1:', _get_wave('Hello, my name is John.'))
print('Elapsed time:', time.time() - start)

start = time.time()
print('Audio 2:', _get_wave('Hello, my name is NOT John.'))
print('Elapsed time:', time.time() - start)

This outputs:

Using cache found in C:\Users\tsbertalan/.cache\torch\hub\snakers4_silero-models_master
Audio 1: tensor([ 1.0235e-02,  8.2890e-03,  6.3193e-03,  ...,  4.1780e-07,
        -1.7477e-05,  2.7110e-06])
Elapsed time: 2.8421778678894043

and then never outputs the second evaluation.

Expected behavior

Multiple model calls should produce output, perhaps with subsequent calls being in fact faster than the first.

Environment

Please copy and paste the output from this
environment collection script

Collecting environment information...
PyTorch version: 2.0.1+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 Pro
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A

Python version: 3.8.16 (default, Mar  2 2023, 03:18:16) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19045-SP0
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1080
Nvidia driver version: 536.23
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture=9
CurrentClockSpeed=3501
DeviceID=CPU0
Family=198
L2CacheSize=1024
L2CacheSpeed=
Manufacturer=GenuineIntel
MaxClockSpeed=3501
Name=Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
ProcessorType=3
Revision=15363

Versions of relevant libraries:
[pip3] numpy==1.24.3
[pip3] torch==2.0.1+cu118
[pip3] torchaudio==2.0.2+cu118
[pip3] torchvision==0.15.2+cu118
[conda] Could not collect
  • PyTorch Version (e.g., 1.0):
  • How you installed PyTorch (conda, pip, source): pip

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions