Skip to content

Commit 34b77a9

Browse files
committed
Update RESULTS.md. test=doc
1 parent dd9b764 commit 34b77a9

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

examples/iwslt2012/punc0/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
The pretrained model can be downloaded here [ernie_linear_p3_iwslt2012_zh_ckpt_0.1.1.zip](https://paddlespeech.bj.bcebos.com/text/ernie_linear_p3_iwslt2012_zh_ckpt_0.1.1.zip).
2222

2323
### Test Result
24-
- Ernie Linear
24+
- Ernie
2525
| |COMMA | PERIOD | QUESTION | OVERALL|
2626
|:-----:|:-----:|:-----:|:-----:|:-----:|
2727
|Precision |0.510955 |0.526462 |0.820755 |0.619391|
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import numpy as np
15+
16+
17+
def pcm16to32(audio: np.ndarray) -> np.ndarray:
18+
"""pcm int16 to float32
19+
20+
Args:
21+
audio (np.ndarray): Waveform with dtype of int16.
22+
23+
Returns:
24+
np.ndarray: Waveform with dtype of float32.
25+
"""
26+
if audio.dtype == np.int16:
27+
audio = audio.astype("float32")
28+
bits = np.iinfo(np.int16).bits
29+
audio = audio / (2**(bits - 1))
30+
return audio

0 commit comments

Comments
 (0)