pytorch/hub

RuntimeError: Unknown builtin op: aten::reflection_pad3d while using silero models

mobassir11 opened this issue · 1 comments

i tried nothing fancy,just the tutorial from your documentation like this

#@title Install dependencies


!pip install -q torchaudio omegaconf

import torch
from pprint import pprint
from omegaconf import OmegaConf
from IPython.display import Audio, display

torch.hub.download_url_to_file('https://raw.githubusercontent.com/snakers4/silero-models/master/models.yml',
                               'latest_silero_models.yml',
                               progress=False)
models = OmegaConf.load('latest_silero_models.yml')
# V3
import torch
!pip install aksharamukha
from aksharamukha import transliterate

# Loading model
model, example_text = torch.hub.load(repo_or_dir='snakers4/silero-models',
                                     model='silero_tts',
                                     language='indic',
                                     speaker='v3_indic')

orig_text = "प्रसिद्द कबीर अध्येता, पुरुषोत्तम अग्रवाल का यह शोध आलेख, उस रामानंद की खोज करता है"
roman_text = transliterate.process('Devanagari', 'ISO', orig_text)
print(roman_text)

audio = model.apply_tts(roman_text,
                        speaker='hindi_male')

error

Using cache found in /root/.cache/torch/hub/snakers4_silero-models_master
100%
54.5M/54.5M [00:06<00:00, 11.7MB/s]
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/tmp/ipykernel_33/408325770.py in <module>
      8                                      model='silero_tts',
      9                                      language='indic',
---> 10                                      speaker='v3_indic')
     11 
     12 orig_text = "प्रसिद्द कबीर अध्येता, पुरुषोत्तम अग्रवाल का यह शोध आलेख, उस रामानंद की खोज करता है"

/opt/conda/lib/python3.7/site-packages/torch/hub.py in load(repo_or_dir, model, *args, **kwargs)
    380         repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose, skip_validation)
    381 
--> 382     model = _load_local(repo_or_dir, model, *args, **kwargs)
    383     return model
    384 

/opt/conda/lib/python3.7/site-packages/torch/hub.py in _load_local(hubconf_dir, model, *args, **kwargs)
    409 
    410     entry = _load_entry_from_hubconf(hub_module, model)
--> 411     model = entry(*args, **kwargs)
    412 
    413     sys.path.remove(hubconf_dir)

~/.cache/torch/hub/snakers4_silero-models_master/src/silero/silero.py in silero_tts(language, speaker, **kwargs)
     86                                            progress=True)
     87         imp = package.PackageImporter(model_path)
---> 88         model = imp.load_pickle("tts_models", "model")
     89         if speaker == 'multi_v2':
     90             avail_speakers = model_conf.speakers

/opt/conda/lib/python3.7/site-packages/torch/package/package_importer.py in load_pickle(self, package, resource, map_location)
    233 
    234         with set_deserialization_context():
--> 235             result = unpickler.load()
    236 
    237         # TODO from zdevito:

/opt/conda/lib/python3.7/pickle.py in load(self)
   1086                     raise EOFError
   1087                 assert isinstance(key, bytes_types)
-> 1088                 dispatch[key[0]](self)
   1089         except _Stop as stopinst:
   1090             return stopinst.value

/opt/conda/lib/python3.7/pickle.py in load_binpersid(self)
   1127     def load_binpersid(self):
   1128         pid = self.stack.pop()
-> 1129         self.append(self.persistent_load(pid))
   1130     dispatch[BINPERSID[0]] = load_binpersid
   1131 

/opt/conda/lib/python3.7/site-packages/torch/package/package_importer.py in persistent_load(saved_id)
    211                 reduce_id, func, args = data
    212                 if reduce_id not in loaded_reduces:
--> 213                     loaded_reduces[reduce_id] = func(self, *args)
    214                 return loaded_reduces[reduce_id]
    215             else:

/opt/conda/lib/python3.7/site-packages/torch/jit/_script.py in unpackage_script_module(importer, script_module_id)
    353         importer.storage_context,
    354         validate_map_location(importer.last_map_location),
--> 355         script_module_id,
    356     )
    357     return wrap_cpp_module(cpp_module)

RuntimeError: 
Unknown builtin op: aten::reflection_pad3d.
Here are some suggestions: 
	aten::reflection_pad1d
	aten::reflection_pad2d

The original call is:
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/functional.py", line 4199
        elif len(pad) == 6 and (input.dim() == 4 or input.dim() == 5):
            if mode == "reflect":
                return torch._C._nn.reflection_pad3d(input, pad)
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
            elif mode == "replicate":
                return torch._C._nn.replication_pad3d(input, pad)
Serialized   File ".data/ts_code/code/__torch__/torch/nn/functional.py", line 649
        if _175:
          if torch.eq(mode, "reflect"):
            _180 = torch.reflection_pad3d(input, pad)
                   ~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
            _179 = _180
          else:
'_pad' is being compiled since it was called from 'multi_head_attention_forward'
Serialized   File ".data/ts_code/code/__torch__/torch/nn/functional.py", line 260
    if torch.__isnot__(attn_mask0, None):
      attn_mask6 = unchecked_cast(Tensor, attn_mask0)
      attn_mask7 = __torch__.torch.nn.functional._pad(attn_mask6, [0, 1], "constant", 0., )
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
      attn_mask5 : Optional[Tensor] = attn_mask7
    else:
'multi_head_attention_forward' is being compiled since it was called from 'MultiheadAttention.forward'
Serialized   File ".data/ts_code/code/__torch__/torch/nn/modules/activation.py", line 30
    need_weights: bool=True,
    attn_mask: Optional[Tensor]=None) -> Tuple[Tensor, Optional[Tensor]]:
    _0 = __torch__.torch.nn.functional.multi_head_attention_forward
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
    _1 = annotate(List[Tensor], [])
    _2 = torch.append(_1, torch.transpose(query, 1, 0))

discussed and solved here snakers4/silero-models#172