Skip to content

Commit 35c953a

Browse files
committed
PyThaiASR v1.1.1
- Fixed bug with wav2vec2 (non-lm)
1 parent 636e67b commit 35c953a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pythaiasr/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ def __call__(self, file: str) -> str:
5252
input_dict = self.processor(a["input_values"][0], return_tensors="pt", padding=True)
5353
logits = self.model(input_dict.input_values).logits
5454
pred_ids = torch.argmax(logits, dim=-1)[0]
55-
56-
txt = self.processor.batch_decode(logits.detach().numpy()).text[0]
55+
if self.model_name == "airesearch/wav2vec2-large-xlsr-53-th":
56+
txt = self.processor.decode(pred_ids).replace(' ','')
57+
else:
58+
txt = self.processor.batch_decode(logits.detach().numpy()).text[0]
5759
return txt
5860

5961
_model_name = "airesearch/wav2vec2-large-xlsr-53-th"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def read(*paths):
2727

2828
setup(
2929
name='pythaiasr',
30-
version='1.1.0',
30+
version='1.1.1',
3131
packages=['pythaiasr'],
3232
url='https://github.com/pythainlp/pythaiasr',
3333
license='Apache Software License 2.0',

0 commit comments

Comments
 (0)