Views
No views yet
mixed flavor during our training, meaning we combine data from hyp2ora and deg2ref flavors. After the prompt builder, we have a total of 48,142 prompt-completion pairs in our training set.| System | WER (%) | WDER (%) | cpWER (%) |
|---|---|---|---|
| USM + turn-to-diarize baseline | 15.48 | 5.32 | 21.19 |
| + This model | - | 3.65 | 18.92 |
pip install transformers diarizationlm1from transformers import LlamaForCausalLM, LlamaTokenizer
2from diarizationlm import utils
3
4HYPOTHESIS = """<speaker:1> Hello, how are you doing <speaker:2> today? I am doing well. What about <speaker:1> you? I'm doing well, too. Thank you."""
5
6print("Loading model...")
7tokenizer = LlamaTokenizer.from_pretrained("google/DiarizationLM-13b-Fisher-v1", device_map="cuda")
8model = LlamaForCausalLM.from_pretrained("google/DiarizationLM-13b-Fisher-v1", device_map="cuda")
9
10print("Tokenizing input...")
11inputs = tokenizer([HYPOTHESIS + " --> "], return_tensors = "pt").to("cuda")
12
13print("Generating completion...")
14outputs = model.generate(**inputs,
15 max_new_tokens = inputs.input_ids.shape[1] * 1.2,
16 use_cache = False)
17
18print("Decoding completion...")
19completion = tokenizer.batch_decode(outputs[:, inputs.input_ids.shape[1]:],
20 skip_special_tokens = True)[0]
21
22print("Transferring completion to hypothesis text...")
23transferred_completion = utils.transfer_llm_completion(completion, HYPOTHESIS)
24
25print("========================================")
26print("Hypothesis:", HYPOTHESIS)
27print("========================================")
28print("Completion:", completion)
29print("========================================")
30print("Transferred completion:", transferred_completion)
31print("========================================")Loading model...
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:17<00:00, 2.84s/it]
Tokenizing input...
Generating completion...
Decoding completion...
Transferring completion to hypothesis text...
========================================
Hypothesis: <speaker:1> Hello, how are you doing <speaker:2> today? I am doing well. What about <speaker:1> you? I'm doing well, too. Thank you.
========================================
Completion: 19:27 <speaker:1> hello, how are you doing today? <speaker:2> i am doing well. What about you? <speaker:1> i'm doing well, too. thank you. <speaker:2> my name
========================================
Transferred completion: <speaker:1> Hello, how are you doing today? <speaker:2> I am doing well. What about you? <speaker:1> I'm doing well, too. Thank you.@article{wang2024diarizationlm,
title={{DiarizationLM: Speaker Diarization Post-Processing with Large Language Models}},
author={Quan Wang and Yiling Huang and Guanlong Zhao and Evan Clark and Wei Xia and Hank Liao},
journal={arXiv preprint arXiv:2401.03506},
year={2024}
}