Abdo-Alshoki commited on
Commit
994e0fc
·
verified ·
1 Parent(s): e37bd9a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +196 -187
README.md CHANGED
@@ -2,198 +2,207 @@
2
  library_name: transformers
3
  tags: []
4
  ---
 
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
 
 
 
 
10
 
 
11
 
12
- ## Model Details
13
-
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
 
107
- ### Testing Data, Factors & Metrics
 
 
 
108
 
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
-
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  library_name: transformers
3
  tags: []
4
  ---
5
+ # DeepAr
6
 
7
+ ## Model Description
8
 
9
+ DeepAr is a state-of-the-art Arabic Automatic Speech Recognition (ASR) model based on whisper-turbo-v3 architecture. This model represents our latest and most advanced version, trained on the complete [CUAIStudents/Ar-ASR](https://huggingface.co/datasets/CUAIStudents/Ar-ASR) dataset for optimal performance.
10
 
11
+ **Key Features:**
12
+ - **High-fidelity transcription**: Transcribes exactly what is pronounced, maintaining authenticity of speech patterns
13
+ - **Speech improvement tool**: Designed to help users identify and correct speech patterns
14
+ - **Superior performance**: Outperforms many existing Arabic ASR models based on Whisper and its variants
15
+ - **Arabic with Tashkil**: Provides accurate diacritization for comprehensive Arabic text output
16
 
17
+ ## What Makes DeepAr Different
18
 
19
+ Unlike traditional ASR models that normalize speech to standard text, DeepAr transcribes **exactly what is pronounced**. This unique approach makes it particularly valuable for:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ - **Speech therapy and improvement**: Identifies pronunciation patterns and deviations
22
+ - **Language learning**: Helps learners understand their actual pronunciation vs. intended speech
23
+ - **Linguistic research**: Captures authentic speech patterns for analysis
24
+ - **Pronunciation assessment**: Provides detailed feedback on spoken Arabic
25
 
26
+ ## Model Details
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
+ - **Base Architecture**: whisper-turbo-v3
29
+ - **Language**: Arabic (with Tashkil/diacritics)
30
+ - **Task**: High-fidelity Automatic Speech Recognition
31
+ - **Training Data**: Complete [CUAIStudents/Ar-ASR](https://huggingface.co/datasets/CUAIStudents/Ar-ASR) dataset
32
+ - **Model Type**: Production-ready, latest version
33
+
34
+ ## Performance
35
+
36
+ DeepAr demonstrates superior performance compared to many Arabic ASR models built on Whisper and its variants, particularly excelling in:
37
+ - Pronunciation accuracy detection
38
+ - Diacritic prediction
39
+ - Handling of Arabic speech variations
40
+ - Authentic speech pattern recognition
41
+
42
+ ## Intended Use
43
+
44
+ This model is ideal for:
45
+ - Speech therapy and pronunciation correction applications
46
+ - Arabic language learning platforms
47
+ - Linguistic research and analysis
48
+ - Educational tools for speech improvement
49
+ - Applications requiring authentic speech transcription
50
+ - Quality assessment of spoken Arabic
51
+
52
+ ## Usage
53
+
54
+ ### Installation
55
+
56
+ ```bash
57
+ pip install transformers torch torchaudio
58
+ ```
59
+
60
+ ### Quick Start
61
+
62
+ ```python
63
+ from transformers import WhisperProcessor, WhisperForConditionalGeneration
64
+ import torch
65
+ import torchaudio
66
+
67
+ # Load model and processor
68
+ processor = WhisperProcessor.from_pretrained("CUAIStudents/DeepAr")
69
+ model = WhisperForConditionalGeneration.from_pretrained("CUAIStudents/DeepAr")
70
+
71
+ # Load and preprocess audio
72
+ audio_path = "path_to_your_arabic_audio.wav"
73
+ waveform, sample_rate = torchaudio.load(audio_path)
74
+
75
+ # Resample to 16kHz if necessary
76
+ if sample_rate != 16000:
77
+ resampler = torchaudio.transforms.Resample(sample_rate, 16000)
78
+ waveform = resampler(waveform)
79
+
80
+ # Process audio
81
+ input_features = processor(waveform.squeeze().numpy(), sampling_rate=16000, return_tensors="pt").input_features
82
+
83
+ # Generate transcription
84
+ with torch.no_grad():
85
+ predicted_ids = model.generate(input_features, language="ar")
86
+
87
+ # Decode transcription (exactly as pronounced)
88
+ transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
89
+ print(f"Pronounced as: {transcription}")
90
+ ```
91
+
92
+ ### Speech Analysis Example
93
+
94
+ ```python
95
+ def analyze_pronunciation(audio_path, target_text=None):
96
+ """
97
+ Analyze pronunciation and compare with target text if provided
98
+ """
99
+ waveform, sample_rate = torchaudio.load(audio_path)
100
+
101
+ if sample_rate != 16000:
102
+ resampler = torchaudio.transforms.Resample(sample_rate, 16000)
103
+ waveform = resampler(waveform)
104
+
105
+ input_features = processor(waveform.squeeze().numpy(), sampling_rate=16000, return_tensors="pt").input_features
106
+
107
+ with torch.no_grad():
108
+ predicted_ids = model.generate(input_features, language="ar")
109
+
110
+ actual_pronunciation = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
111
+
112
+ print(f"Actual pronunciation: {actual_pronunciation}")
113
+
114
+ if target_text:
115
+ print(f"Target text: {target_text}")
116
+ print("Analysis: Compare the differences for speech improvement")
117
+
118
+ return actual_pronunciation
119
+
120
+ # Example usage
121
+ pronunciation = analyze_pronunciation("student_reading.wav", "النص المطلوب قراءته")
122
+ ```
123
+
124
+ ### Batch Processing for Speech Assessment
125
+
126
+ ```python
127
+ def assess_multiple_recordings(audio_files, target_texts=None):
128
+ """
129
+ Process multiple recordings for comprehensive speech assessment
130
+ """
131
+ results = []
132
+
133
+ for i, audio_file in enumerate(audio_files):
134
+ waveform, sample_rate = torchaudio.load(audio_file)
135
+
136
+ if sample_rate != 16000:
137
+ resampler = torchaudio.transforms.Resample(sample_rate, 16000)
138
+ waveform = resampler(waveform)
139
+
140
+ input_features = processor(waveform.squeeze().numpy(), sampling_rate=16000, return_tensors="pt").input_features
141
+
142
+ with torch.no_grad():
143
+ predicted_ids = model.generate(input_features, language="ar")
144
+
145
+ pronunciation = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
146
+
147
+ result = {
148
+ 'file': audio_file,
149
+ 'pronunciation': pronunciation,
150
+ 'target': target_texts[i] if target_texts else None
151
+ }
152
+ results.append(result)
153
+
154
+ print(f"File {i+1}: {pronunciation}")
155
+
156
+ return results
157
+
158
+ # Example usage
159
+ audio_files = ["recording1.wav", "recording2.wav", "recording3.wav"]
160
+ target_texts = ["النص الأول", "النص الثاني", "النص الثالث"]
161
+ assessment_results = assess_multiple_recordings(audio_files, target_texts)
162
+ ```
163
+
164
+
165
+ ## Training Data
166
+
167
+ This model was trained on the complete [CUAIStudents/Ar-ASR](https://huggingface.co/datasets/CUAIStudents/Ar-ASR) dataset, utilizing the full scope of available Arabic speech data with corresponding high-quality transcriptions including diacritics.
168
+
169
+ ## Model Advantages
170
+
171
+ - **Authentic transcription**: Captures exactly what is spoken, not what should be spoken
172
+ - **High accuracy**: Superior performance compared to similar Whisper-based Arabic models
173
+ - **Comprehensive training**: Utilizes the complete dataset for optimal coverage
174
+ - **Practical applications**: Specifically designed for speech improvement and assessment
175
+ - **Diacritic accuracy**: Excellent performance in Arabic diacritization
176
+
177
+
178
+ ## Limitations
179
+
180
+ - **MSA focus**: Optimized primarily for Modern Standard Arabic (MSA) rather than dialectal variations
181
+
182
+ ## License
183
+
184
+ This model is released under the MIT License.
185
+
186
+ ```
187
+ MIT License
188
+
189
+ Copyright (c) 2024 CUAIStudents
190
+
191
+ Permission is hereby granted, free of charge, to any person obtaining a copy
192
+ of this software and associated documentation files (the "Software"), to deal
193
+ in the Software without restriction, including without limitation the rights
194
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
195
+ copies of the Software, and to permit persons to whom the Software is
196
+ furnished to do so, subject to the following conditions:
197
+
198
+ The above copyright notice and this permission notice shall be included in all
199
+ copies or substantial portions of the Software.
200
+
201
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
202
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
203
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
204
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
205
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
206
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
207
+ SOFTWARE.
208
+ ```