Skip to content

Commit

Permalink
PyThaiASR v1.1.1
Browse files Browse the repository at this point in the history
- Fixed bug with wav2vec2 (non-lm)
  • Loading branch information
wannaphong committed Aug 11, 2022
1 parent 636e67b commit 35c953a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pythaiasr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ def __call__(self, file: str) -> str:
input_dict = self.processor(a["input_values"][0], return_tensors="pt", padding=True)
logits = self.model(input_dict.input_values).logits
pred_ids = torch.argmax(logits, dim=-1)[0]

txt = self.processor.batch_decode(logits.detach().numpy()).text[0]
if self.model_name == "airesearch/wav2vec2-large-xlsr-53-th":
txt = self.processor.decode(pred_ids).replace(' ','')
else:
txt = self.processor.batch_decode(logits.detach().numpy()).text[0]
return txt

_model_name = "airesearch/wav2vec2-large-xlsr-53-th"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def read(*paths):

setup(
name='pythaiasr',
version='1.1.0',
version='1.1.1',
packages=['pythaiasr'],
url='https://github.com/pythainlp/pythaiasr',
license='Apache Software License 2.0',
Expand Down

0 comments on commit 35c953a

Please sign in to comment.