Views
No views yet
| Training Loss | Epoch | Step | Validation Loss | Wer |
|---|---|---|---|---|
| 0.9094 | 0.1270 | 500 | 0.6347 | 24.3686 |
| 0.5517 | 0.2541 | 1000 | 0.4835 | 18.0769 |
| 0.5364 | 0.3811 | 1500 | 0.4330 | 15.1149 |
| 0.5503 | 0.5081 | 2000 | 0.4113 | 13.6524 |
| 0.6521 | 0.6352 | 2500 | 0.3987 | 13.5897 |
| 0.6044 | 0.7622 | 3000 | 0.3912 | 13.0538 |
| 0.5487 | 0.8892 | 3500 | 0.3835 | 12.6119 |
| 0.5297 | 1.0163 | 4000 | 0.3791 | 12.4408 |
| 0.46 | 1.1433 | 4500 | 0.3751 | 12.3525 |
| 0.4947 | 1.2703 | 5000 | 0.3721 | 12.1415 |
| 0.524 | 1.3974 | 5500 | 0.3682 | 13.0139 |
| 0.4743 | 1.5244 | 6000 | 0.3649 | 13.3388 |
| 0.5338 | 1.6514 | 6500 | 0.3621 | 12.9397 |
| 0.5162 | 1.7785 | 7000 | 0.3597 | 13.3246 |
| 0.5004 | 1.9055 | 7500 | 0.3590 | 12.3268 |
1pip install --upgrade pip
2pip install --upgrade transformers datasets[audio] accelerate1import torch
2from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
3from datasets import load_dataset
4
5device = "cuda:0" if torch.cuda.is_available() else "cpu"
6torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
7
8def download_adapter_model():
9 model_name = "whisper-v3-LoRA-en_students"
10 print(f"Downloading the adapter model '{model_name}' from the Hugging Face Hub.", flush=True)
11
12 # Define the path for the directory
13 local_directory = os.path.expanduser("~/.cache/huggingface/hub")
14
15 # Check if the directory exists
16 if not os.path.exists(local_directory):
17 # If it doesn't exist, create it
18 os.makedirs(local_directory)
19 print(f"Directory '{local_directory}' created.", flush=True)
20 else:
21 print(f"Directory '{local_directory}' already exists.", flush=True)
22
23 repo_id = f"Transducens/{model_name}"
24 repo_adapter_dir = f"{model_name}/checkpoint-5000/adapter_model"
25 repo_filename_config = f"{repo_adapter_dir}/adapter_config.json"
26 repo_filename_tensors = f"{repo_adapter_dir}/adapter_model.safetensors"
27
28 adapter_config = hf_hub_download(repo_id=repo_id, filename=repo_filename_config, local_dir=local_directory)
29 adapter_model_tensors = hf_hub_download(repo_id=repo_id, filename=repo_filename_tensors, local_dir=local_directory)
30
31 print(f"Dowloaded the adapter model '{model_name}' from the Hugging Face Hub.", flush=True)
32
33 return os.path.join(local_directory, repo_adapter_dir)
34
35peft_model_id = adapter_path # Use the same model ID as before.
36peft_config = PeftConfig.from_pretrained(peft_model_id)
37model = WhisperForConditionalGeneration.from_pretrained(
38peft_config.base_model_name_or_path, load_in_8bit=False)
39
40model = PeftModel.from_pretrained(model, peft_model_id)
41model.generation_config.language = "<|en|>"
42model.generation_config.task = "transcribe"
43
44tokenizer = WhisperTokenizer.from_pretrained("openai/whisper-large-v3", task="transcribe")
45feature_extractor = WhisperFeatureExtractor.from_pretrained("openai/whisper-large-v3")
46
47pipe = pipeline(model=model, tokenizer=tokenizer, feature_extractor=feature_extractor, task="automatic-speech-recognition", device=device)
48
49
50### Framework versions
51
52- PEFT 0.11.1
53- Transformers 4.42.4
54- Pytorch 2.1.0+cu118
55- Datasets 2.20.0
56- Tokenizers 0.19.1