upgrade path from old giga-am to new (#1088)
This commit is contained in:
parent
5a3e6e33d1
commit
2eeb21296d
2 changed files with 304 additions and 4 deletions
257
src-tauri/resources/models/gigaam_vocab.txt
Normal file
257
src-tauri/resources/models/gigaam_vocab.txt
Normal file
|
|
@ -0,0 +1,257 @@
|
||||||
|
<unk> 0
|
||||||
|
▁ 1
|
||||||
|
. 2
|
||||||
|
е 3
|
||||||
|
а 4
|
||||||
|
с 5
|
||||||
|
и 6
|
||||||
|
, 7
|
||||||
|
о 8
|
||||||
|
т 9
|
||||||
|
н 10
|
||||||
|
м 11
|
||||||
|
у 12
|
||||||
|
й 13
|
||||||
|
л 14
|
||||||
|
я 15
|
||||||
|
в 16
|
||||||
|
д 17
|
||||||
|
з 18
|
||||||
|
к 19
|
||||||
|
но 20
|
||||||
|
▁с 21
|
||||||
|
ы 22
|
||||||
|
г 23
|
||||||
|
▁в 24
|
||||||
|
б 25
|
||||||
|
р 26
|
||||||
|
п 27
|
||||||
|
то 28
|
||||||
|
ть 29
|
||||||
|
ра 30
|
||||||
|
▁по 31
|
||||||
|
ка 32
|
||||||
|
ш 33
|
||||||
|
ни 34
|
||||||
|
ли 35
|
||||||
|
на 36
|
||||||
|
го 37
|
||||||
|
х 38
|
||||||
|
ро 39
|
||||||
|
ва 40
|
||||||
|
▁на 41
|
||||||
|
ю 42
|
||||||
|
ко 43
|
||||||
|
ль 44
|
||||||
|
те 45
|
||||||
|
? 46
|
||||||
|
ч 47
|
||||||
|
ж 48
|
||||||
|
во 49
|
||||||
|
ла 50
|
||||||
|
ре 51
|
||||||
|
да 52
|
||||||
|
▁и 53
|
||||||
|
ло 54
|
||||||
|
ст 55
|
||||||
|
- 56
|
||||||
|
ё 57
|
||||||
|
▁не 58
|
||||||
|
ле 59
|
||||||
|
ри 60
|
||||||
|
де 61
|
||||||
|
та 62
|
||||||
|
ны 63
|
||||||
|
▁В 64
|
||||||
|
▁С 65
|
||||||
|
ь 66
|
||||||
|
ки 67
|
||||||
|
ер 68
|
||||||
|
▁о 69
|
||||||
|
ви 70
|
||||||
|
ти 71
|
||||||
|
ма 72
|
||||||
|
▁за 73
|
||||||
|
▁А 74
|
||||||
|
▁Т 75
|
||||||
|
▁у 76
|
||||||
|
же 77
|
||||||
|
э 78
|
||||||
|
▁М 79
|
||||||
|
ц 80
|
||||||
|
ди 81
|
||||||
|
не 82
|
||||||
|
ру 83
|
||||||
|
че 84
|
||||||
|
ф 85
|
||||||
|
ве 86
|
||||||
|
▁Д 87
|
||||||
|
бо 88
|
||||||
|
▁К 89
|
||||||
|
щ 90
|
||||||
|
▁О 91
|
||||||
|
ми 92
|
||||||
|
▁что 93
|
||||||
|
▁« 94
|
||||||
|
» 95
|
||||||
|
ся 96
|
||||||
|
▁По 97
|
||||||
|
▁про 98
|
||||||
|
e 99
|
||||||
|
a 100
|
||||||
|
ку 101
|
||||||
|
ну 102
|
||||||
|
▁это 103
|
||||||
|
мо 104
|
||||||
|
жи 105
|
||||||
|
▁ко 106
|
||||||
|
▁П 107
|
||||||
|
▁И 108
|
||||||
|
ча 109
|
||||||
|
му 110
|
||||||
|
0 111
|
||||||
|
ты 112
|
||||||
|
ста 113
|
||||||
|
сь 114
|
||||||
|
▁как 115
|
||||||
|
o 116
|
||||||
|
▁мо 117
|
||||||
|
i 118
|
||||||
|
до 119
|
||||||
|
ля 120
|
||||||
|
▁до 121
|
||||||
|
▁от 122
|
||||||
|
У 123
|
||||||
|
Б 124
|
||||||
|
ры 125
|
||||||
|
чи 126
|
||||||
|
ци 127
|
||||||
|
▁бы 128
|
||||||
|
▁Включи 129
|
||||||
|
па 130
|
||||||
|
ключ 131
|
||||||
|
по 132
|
||||||
|
ду 133
|
||||||
|
▁при 134
|
||||||
|
— 135
|
||||||
|
Л 136
|
||||||
|
n 137
|
||||||
|
Р 138
|
||||||
|
сто 139
|
||||||
|
r 140
|
||||||
|
▁так 141
|
||||||
|
сти 142
|
||||||
|
Г 143
|
||||||
|
▁На 144
|
||||||
|
Н 145
|
||||||
|
▁об 146
|
||||||
|
▁мне 147
|
||||||
|
l 148
|
||||||
|
Я 149
|
||||||
|
t 150
|
||||||
|
1 151
|
||||||
|
▁За 152
|
||||||
|
s 153
|
||||||
|
Э 154
|
||||||
|
Ч 155
|
||||||
|
Е 156
|
||||||
|
▁есть 157
|
||||||
|
ень 158
|
||||||
|
▁Ну 159
|
||||||
|
2 160
|
||||||
|
▁Сбер 161
|
||||||
|
вер 162
|
||||||
|
▁вот 163
|
||||||
|
ение 164
|
||||||
|
смотр 165
|
||||||
|
В 166
|
||||||
|
▁раз 167
|
||||||
|
Ф 168
|
||||||
|
▁пере 169
|
||||||
|
ешь 170
|
||||||
|
▁тебя 171
|
||||||
|
u 172
|
||||||
|
3 173
|
||||||
|
5 174
|
||||||
|
d 175
|
||||||
|
y 176
|
||||||
|
Х 177
|
||||||
|
4 178
|
||||||
|
З 179
|
||||||
|
S 180
|
||||||
|
С 181
|
||||||
|
h 182
|
||||||
|
c 183
|
||||||
|
m 184
|
||||||
|
9 185
|
||||||
|
: 186
|
||||||
|
8 187
|
||||||
|
6 188
|
||||||
|
7 189
|
||||||
|
M 190
|
||||||
|
B 191
|
||||||
|
П 192
|
||||||
|
D 193
|
||||||
|
T 194
|
||||||
|
! 195
|
||||||
|
k 196
|
||||||
|
g 197
|
||||||
|
О 198
|
||||||
|
C 199
|
||||||
|
Ш 200
|
||||||
|
М 201
|
||||||
|
A 202
|
||||||
|
p 203
|
||||||
|
Ю 204
|
||||||
|
P 205
|
||||||
|
Т 206
|
||||||
|
К 207
|
||||||
|
А 208
|
||||||
|
L 209
|
||||||
|
b 210
|
||||||
|
Д 211
|
||||||
|
ъ 212
|
||||||
|
H 213
|
||||||
|
% 214
|
||||||
|
F 215
|
||||||
|
v 216
|
||||||
|
V 217
|
||||||
|
R 218
|
||||||
|
O 219
|
||||||
|
I 220
|
||||||
|
И 221
|
||||||
|
N 222
|
||||||
|
Ж 223
|
||||||
|
" 224
|
||||||
|
K 225
|
||||||
|
G 226
|
||||||
|
Ц 227
|
||||||
|
f 228
|
||||||
|
w 229
|
||||||
|
E 230
|
||||||
|
₽ 231
|
||||||
|
W 232
|
||||||
|
J 233
|
||||||
|
x 234
|
||||||
|
z 235
|
||||||
|
' 236
|
||||||
|
U 237
|
||||||
|
Y 238
|
||||||
|
& 239
|
||||||
|
Z 240
|
||||||
|
X 241
|
||||||
|
+ 242
|
||||||
|
/ 243
|
||||||
|
Щ 244
|
||||||
|
; 245
|
||||||
|
j 246
|
||||||
|
Й 247
|
||||||
|
q 248
|
||||||
|
Q 249
|
||||||
|
° 250
|
||||||
|
Ё 251
|
||||||
|
Ы 252
|
||||||
|
€ 253
|
||||||
|
$ 254
|
||||||
|
« 255
|
||||||
|
<blk> 256
|
||||||
|
|
@ -419,13 +419,13 @@ impl ModelManager {
|
||||||
id: "gigaam-v3-e2e-ctc".to_string(),
|
id: "gigaam-v3-e2e-ctc".to_string(),
|
||||||
name: "GigaAM v3".to_string(),
|
name: "GigaAM v3".to_string(),
|
||||||
description: "Russian speech recognition. Fast and accurate.".to_string(),
|
description: "Russian speech recognition. Fast and accurate.".to_string(),
|
||||||
filename: "giga-am-v3.int8.onnx".to_string(),
|
filename: "giga-am-v3-int8".to_string(),
|
||||||
url: Some("https://blob.handy.computer/giga-am-v3.int8.onnx".to_string()),
|
url: Some("https://blob.handy.computer/giga-am-v3-int8.tar.gz".to_string()),
|
||||||
size_mb: 225,
|
size_mb: 152,
|
||||||
is_downloaded: false,
|
is_downloaded: false,
|
||||||
is_downloading: false,
|
is_downloading: false,
|
||||||
partial_size: 0,
|
partial_size: 0,
|
||||||
is_directory: false,
|
is_directory: true,
|
||||||
engine_type: EngineType::GigaAM,
|
engine_type: EngineType::GigaAM,
|
||||||
accuracy_score: 0.85,
|
accuracy_score: 0.85,
|
||||||
speed_score: 0.75,
|
speed_score: 0.75,
|
||||||
|
|
@ -518,6 +518,9 @@ impl ModelManager {
|
||||||
// Migrate any bundled models to user directory
|
// Migrate any bundled models to user directory
|
||||||
manager.migrate_bundled_models()?;
|
manager.migrate_bundled_models()?;
|
||||||
|
|
||||||
|
// Migrate GigaAM from single-file to directory format
|
||||||
|
manager.migrate_gigaam_to_directory()?;
|
||||||
|
|
||||||
// Check which models are already downloaded
|
// Check which models are already downloaded
|
||||||
manager.update_download_status()?;
|
manager.update_download_status()?;
|
||||||
|
|
||||||
|
|
@ -564,6 +567,46 @@ impl ModelManager {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Migrate GigaAM from the old single-file format (giga-am-v3.int8.onnx)
|
||||||
|
/// to the new directory format (giga-am-v3-int8/model.int8.onnx + vocab.txt).
|
||||||
|
/// This was required by the transcribe-rs 0.3.x upgrade.
|
||||||
|
fn migrate_gigaam_to_directory(&self) -> Result<()> {
|
||||||
|
let old_file = self.models_dir.join("giga-am-v3.int8.onnx");
|
||||||
|
let new_dir = self.models_dir.join("giga-am-v3-int8");
|
||||||
|
|
||||||
|
if !old_file.exists() || new_dir.exists() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
info!("Migrating GigaAM from single-file to directory format");
|
||||||
|
|
||||||
|
let vocab_path = self
|
||||||
|
.app_handle
|
||||||
|
.path()
|
||||||
|
.resolve(
|
||||||
|
"resources/models/gigaam_vocab.txt",
|
||||||
|
tauri::path::BaseDirectory::Resource,
|
||||||
|
)
|
||||||
|
.map_err(|e| anyhow::anyhow!("Failed to resolve GigaAM vocab path: {}", e))?;
|
||||||
|
|
||||||
|
info!("Resolved vocab path: {:?} (exists: {})", vocab_path, vocab_path.exists());
|
||||||
|
info!("Old file: {:?} (exists: {})", old_file, old_file.exists());
|
||||||
|
info!("New dir: {:?} (exists: {})", new_dir, new_dir.exists());
|
||||||
|
|
||||||
|
fs::create_dir_all(&new_dir)?;
|
||||||
|
fs::rename(&old_file, new_dir.join("model.int8.onnx"))?;
|
||||||
|
fs::copy(&vocab_path, new_dir.join("vocab.txt"))?;
|
||||||
|
|
||||||
|
// Clean up old partial file if it exists
|
||||||
|
let old_partial = self.models_dir.join("giga-am-v3.int8.onnx.partial");
|
||||||
|
if old_partial.exists() {
|
||||||
|
let _ = fs::remove_file(&old_partial);
|
||||||
|
}
|
||||||
|
|
||||||
|
info!("GigaAM migration complete");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn update_download_status(&self) -> Result<()> {
|
fn update_download_status(&self) -> Result<()> {
|
||||||
let mut models = self.available_models.lock().unwrap();
|
let mut models = self.available_models.lock().unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue