Update README.md
Browse files
README.md
CHANGED
@@ -87,21 +87,21 @@ The model can be used with the [`pipeline`](https://huggingface.co/docs/transfor
|
|
87 |
class to transcribe audio files of arbitrary length.
|
88 |
|
89 |
```python
|
90 |
-
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
```
|
|
|
87 |
class to transcribe audio files of arbitrary length.
|
88 |
|
89 |
```python
|
90 |
+
from transformers import pipeline
|
91 |
|
92 |
+
model_id = "BUT-FIT/EBranchRegulaFormer-medium"
|
93 |
+
pipe = pipeline("automatic-speech-recognition", model=model_id, feature_extractor=model_id, trust_remote_code=True)
|
94 |
+
# In newer versions of transformers (>4.31.0), there is a bug in the pipeline inference type.
|
95 |
+
# The warning can be ignored.
|
96 |
+
pipe.type = "seq2seq"
|
97 |
|
98 |
+
# Standard greedy decoding
|
99 |
+
result = pipe("audio.wav")
|
100 |
|
101 |
+
# Beam search decoding with joint CTC-attention scorer
|
102 |
+
generation_config = pipe.model.generation_config
|
103 |
+
generation_config.ctc_weight = 0.3
|
104 |
+
generation_config.num_beams = 5
|
105 |
+
generation_config.ctc_margin = 0
|
106 |
+
result = pipe("audio.wav")
|
107 |
```
|