Views
No views yet
google/DiarizationLM-8b-Fisher-v1, the loss is computed also on the prompt tokens.mixed flavor during our training, meaning we combine data from hyp2ora and deg2ref flavors. After the prompt builder, we have a total of 51,063 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.28 | 18.37 |
| System | WER (%) | WDER (%) | cpWER (%) |
|---|---|---|---|
| USM + turn-to-diarize baseline | 15.36 | 7.72 | 24.39 |
| + This model | - | 6.66 | 23.57 |
pip install transformers diarizationlm1from transformers import LlamaForCausalLM, AutoTokenizer
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 = AutoTokenizer.from_pretrained("google/DiarizationLM-8b-Fisher-v2", device_map="cuda")
8model = LlamaForCausalLM.from_pretrained("google/DiarizationLM-8b-Fisher-v2", 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...
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:13<00:00, 3.32s/it]
generation_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 172/172 [00:00<00:00, 992kB/s]
Tokenizing input...
Generating completion...
Setting `pad_token_id` to `eos_token_id`:128001 for open-end generation.
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: <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. [eod] [eod] <speaker:1
========================================
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}
}