Skip to content

Commit a2b6ad2

Browse files
committed
simpler import with pandas.
1 parent cc4db15 commit a2b6ad2

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

examples/pipeline_wav2letter/README.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ This is an example pipeline for speech recognition using a greedy or Viterbi CTC
22

33
### Usage
44

5-
More information about each command line parameters is available with the `--help` option. An example reproducing the demo can be invoked as follows.
5+
More information about each command line parameters is available with the `--help` option. An example can be invoked as follows.
66
```
77
python main.py \
88
--reduce-lr-valid \
@@ -28,30 +28,12 @@ With these default parameters, we get a character error rate of 13.8% on dev-cle
2828
### Output
2929

3030
The information reported at each iteration and epoch (e.g. loss, character error rate, word error rate) is printed to standard output in the form of one json per line, e.g.
31-
```
31+
```python
3232
{"name": "train", "epoch": 0, "cer over target length": 1.0, "cumulative cer": 23317.0, "total chars": 23317.0, "cer": 0.0, "cumulative cer over target length": 0.0, "wer over target length": 1.0, "cumulative wer": 4446.0, "total words": 4446.0, "wer": 0.0, "cumulative wer over target length": 0.0, "lr": 0.6, "batch size": 128, "n_channel": 13, "n_time": 2453, "dataset length": 128.0, "iteration": 1.0, "loss": 8.712121963500977, "cumulative loss": 8.712121963500977, "average loss": 8.712121963500977, "iteration time": 41.46276903152466, "epoch time": 41.46276903152466}
3333
{"name": "train", "epoch": 0, "cer over target length": 1.0, "cumulative cer": 46005.0, "total chars": 46005.0, "cer": 0.0, "cumulative cer over target length": 0.0, "wer over target length": 1.0, "cumulative wer": 8762.0, "total words": 8762.0, "wer": 0.0, "cumulative wer over target length": 0.0, "lr": 0.6, "batch size": 128, "n_channel": 13, "n_time": 1703, "dataset length": 256.0, "iteration": 2.0, "loss": 8.918599128723145, "cumulative loss": 17.63072109222412, "average loss": 8.81536054611206, "iteration time": 1.2905676364898682, "epoch time": 42.753336668014526}
3434
{"name": "train", "epoch": 0, "cer over target length": 1.0, "cumulative cer": 70030.0, "total chars": 70030.0, "cer": 0.0, "cumulative cer over target length": 0.0, "wer over target length": 1.0, "cumulative wer": 13348.0, "total words": 13348.0, "wer": 0.0, "cumulative wer over target length": 0.0, "lr": 0.6, "batch size": 128, "n_channel": 13, "n_time": 1713, "dataset length": 384.0, "iteration": 3.0, "loss": 8.550191879272461, "cumulative loss": 26.180912971496582, "average loss": 8.726970990498861, "iteration time": 1.2109291553497314, "epoch time": 43.96426582336426}
3535
```
36-
Further information is reported to standard error. Here is an example python function to parse the standard output when saved to a file.
37-
```python
38-
def read_json(filename):
39-
"""
40-
Convert the standard output saved to filename into a pandas dataframe for analysis.
41-
"""
42-
43-
import pandas
44-
import json
45-
46-
with open(filename, "r") as f:
47-
data = f.read()
48-
49-
# pandas doesn't read single quotes for json
50-
data = data.replace("'", '"')
51-
52-
data = [json.loads(l) for l in data.splitlines()]
53-
return pandas.DataFrame(data)
54-
```
36+
One way to import the output in python with pandas is by saving the standard output to a file, and then using `pandas.read_json(filename, lines=True)`.
5537

5638
## Structure of pipeline
5739

0 commit comments

Comments
 (0)