dasaem commited on
Commit
b34c2a8
·
verified ·
1 Parent(s): eb0e80d

Add model card

Browse files
Files changed (1) hide show
  1. README.md +100 -0
README.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - ko
5
+ base_model: openai/whisper-large-v2
6
+ pipeline_tag: automatic-speech-recognition
7
+ tags:
8
+ - whisper
9
+ - lyrics-transcription
10
+ - lyrics-alignment
11
+ - korean-folk-song
12
+ - music
13
+ - music-information-retrieval
14
+ ---
15
+
16
+ # RefWhisper
17
+
18
+ Model weights for [RefWhisper](https://github.com/MALerLab/RefWhisper), from the DLfM 2023 paper
19
+ "[Aligning Incomplete Lyrics of Korean Folk Song Dataset using Whisper](https://doi.org/10.1145/3625135.3625154)".
20
+
21
+ RefWhisper is Whisper large-v2 with an extra reference encoder and a reference cross-attention layer in the decoder.
22
+ It transcribes sung lyrics while consulting a pre-transcribed lyric that may be incomplete or partly wrong, and the
23
+ reference cross-attention also aligns that lyric with the transcription and the audio.
24
+
25
+ ## File
26
+
27
+ | File | Contents |
28
+ |---|---|
29
+ | `ref_whisper_weight.pt` | Training checkpoint with `model` (state dict), `optim` (optimizer state) and `dims` (model dimensions). fp32, 11.3 GB. The same file that was previously shared on OneDrive. |
30
+
31
+ ## Model
32
+
33
+ - Initialized from `whisper-large-v2`. The audio encoder is frozen.
34
+ - Reference encoder: token embedding initialized from the Whisper decoder, a learnable positional encoding with a 256-token context, and two residual blocks of 1D convolutions (kernel size 3, 1280 channels).
35
+ - Decoder: the last 16 of the 32 blocks get a reference cross-attention layer and are fine-tuned. The earlier blocks and the token embedding are frozen.
36
+ - Training data: synthesized speech (Google Speech API) of two consecutive lines from the lyrics of the *Anthology of Korean Traditional Folksongs*. The reference input is the annotated lyric of the song, with its line order shuffled.
37
+ - AdamW, learning rate 1e-4 for new parameters and 3e-6 for pre-trained ones, batch size 8. This checkpoint was saved at the end of epoch 12 (70,776 steps).
38
+
39
+ ## Usage
40
+
41
+ Install the code from [GitHub](https://github.com/MALerLab/RefWhisper) and run it from the repository root.
42
+
43
+ ```
44
+ git clone https://github.com/MALerLab/RefWhisper.git && cd RefWhisper
45
+ pip install pipenv && pipenv install && pipenv shell
46
+ wget https://huggingface.co/MALer-Lab/refwhisper/resolve/main/ref_whisper_weight.pt
47
+ ```
48
+
49
+ The reference lyric is a plain text file with one lyric line per line.
50
+
51
+ ```
52
+ python -m ref_whisper.inference_timestamped song.wav song.txt --model ref_whisper_weight.pt --language ko --output_dir results
53
+ ```
54
+
55
+ ```python
56
+ from ref_whisper.inference_timestamped import load_model, transcribe_timestamped
57
+
58
+ model = load_model("ref_whisper_weight.pt", device="cuda")
59
+
60
+ # transcription guided by the reference lyric
61
+ result = model.transcribe(audio="song.wav", reference_text="song.txt", temperature=0, language="ko")
62
+
63
+ # transcription with word timestamps and line-level alignment to the reference lyric
64
+ result = transcribe_timestamped(model, "song.wav", "song.txt", language="ko")
65
+ print(result["ref_align_segments"])
66
+ ```
67
+
68
+ ## Results
69
+
70
+ Transcription accuracy on 201 manually transcribed segments (under 30 s) from folk songs that were not used for fine-tuning (Table 2 of the paper):
71
+
72
+ | Model | WER | CER |
73
+ |---|---|---|
74
+ | Whisper large-v2 | 0.722 | 0.384 |
75
+ | Whisper fine-tuned on the synthesized data | 0.804 | 0.478 |
76
+ | RefWhisper | 0.319 | 0.169 |
77
+
78
+ A later re-evaluation of this checkpoint on 352 surviving test segments gave WER 0.331 / CER 0.162 (Whisper large-v2: 0.744 / 0.380).
79
+
80
+ The transcriptions and alignments for 13,801 songs of the anthology, produced with this model, are in
81
+ [`transcription_result_csvs.tar.gz`](https://github.com/MALerLab/RefWhisper/blob/main/transcription_result_csvs.tar.gz).
82
+
83
+ ## License
84
+
85
+ MIT, the same as the code. The audio and lyrics of the *Anthology of Korean Traditional Folksongs* are not included; see the [official website](http://urisori.co.kr/urisori-en/doku.php?id=start).
86
+
87
+ ## Citation
88
+
89
+ ```bibtex
90
+ @inproceedings{han2023aligning,
91
+ title = {Aligning Incomplete Lyrics of Korean Folk Song Dataset using Whisper},
92
+ author = {Han, Danbinaerin and Kim, Daewoong and Jeong, Dasaem},
93
+ booktitle = {Proceedings of the 10th International Conference on Digital Libraries for Musicology (DLfM)},
94
+ pages = {7--11},
95
+ year = {2023},
96
+ address = {Milan, Italy},
97
+ publisher = {ACM},
98
+ doi = {10.1145/3625135.3625154}
99
+ }
100
+ ```