Spaces:
Sleeping
Sleeping
vineelpratap
commited on
Commit
•
8f3fe0f
1
Parent(s):
f0d393c
Update zeroshot.py
Browse files- zeroshot.py +4 -11
zeroshot.py
CHANGED
@@ -151,7 +151,7 @@ def process(
|
|
151 |
device = torch.device("mps")
|
152 |
else:
|
153 |
device = torch.device("cpu")
|
154 |
-
device = torch.device("cpu")
|
155 |
model.to(device)
|
156 |
inputs = inputs.to(device)
|
157 |
yield transcription, logs.add(f"Using device: {device}")
|
@@ -176,9 +176,7 @@ def process(
|
|
176 |
except Exception as e:
|
177 |
yield f"ERROR: Creating lexicon failed '{str(e)}'", logs.text
|
178 |
return
|
179 |
-
|
180 |
-
# if len(v) < 5:
|
181 |
-
# print(k, v)
|
182 |
yield transcription, logs.add(f"Leixcon size: {len(lexicon)}")
|
183 |
|
184 |
# Input could be sentences OR list of words. Check if atleast one word has a count > 1 to diffentiate
|
@@ -200,11 +198,6 @@ def process(
|
|
200 |
# HACK: generate a bigram LM from unigram LM and a dummy bigram to trick it
|
201 |
maybe_generate_pseudo_bigram_arpa(lm_path)
|
202 |
|
203 |
-
# for k, v in lexicon.items():
|
204 |
-
# if len(v) < 5:
|
205 |
-
# print(k, v)
|
206 |
-
|
207 |
-
# print(lexicon["the"], lexicon["\"(t)he"])
|
208 |
with tempfile.NamedTemporaryFile() as lexicon_file:
|
209 |
if lm_path is not None and not lm_path.strip():
|
210 |
lm_path = None
|
@@ -247,8 +240,8 @@ def process(
|
|
247 |
yield transcription, logs.add(f"[DONE]")
|
248 |
|
249 |
|
250 |
-
for i in process("upload/english/english.mp3", "upload/english/c4_5k_sentences.txt"):
|
251 |
-
|
252 |
|
253 |
|
254 |
# for i in process("upload/ligurian/ligurian_1.mp3", "upload/ligurian/zenamt_5k_sentences.txt"):
|
|
|
151 |
device = torch.device("mps")
|
152 |
else:
|
153 |
device = torch.device("cpu")
|
154 |
+
#device = torch.device("cpu")
|
155 |
model.to(device)
|
156 |
inputs = inputs.to(device)
|
157 |
yield transcription, logs.add(f"Using device: {device}")
|
|
|
176 |
except Exception as e:
|
177 |
yield f"ERROR: Creating lexicon failed '{str(e)}'", logs.text
|
178 |
return
|
179 |
+
|
|
|
|
|
180 |
yield transcription, logs.add(f"Leixcon size: {len(lexicon)}")
|
181 |
|
182 |
# Input could be sentences OR list of words. Check if atleast one word has a count > 1 to diffentiate
|
|
|
198 |
# HACK: generate a bigram LM from unigram LM and a dummy bigram to trick it
|
199 |
maybe_generate_pseudo_bigram_arpa(lm_path)
|
200 |
|
|
|
|
|
|
|
|
|
|
|
201 |
with tempfile.NamedTemporaryFile() as lexicon_file:
|
202 |
if lm_path is not None and not lm_path.strip():
|
203 |
lm_path = None
|
|
|
240 |
yield transcription, logs.add(f"[DONE]")
|
241 |
|
242 |
|
243 |
+
# for i in process("upload/english/english.mp3", "upload/english/c4_5k_sentences.txt"):
|
244 |
+
# print(i)
|
245 |
|
246 |
|
247 |
# for i in process("upload/ligurian/ligurian_1.mp3", "upload/ligurian/zenamt_5k_sentences.txt"):
|