Spaces:
Runtime error
Runtime error
Steven Zhang
commited on
Commit
•
f666610
1
Parent(s):
b22f34d
quick testing fix
Browse files
AudioToText/condensedmodel.py
CHANGED
@@ -22,7 +22,7 @@ from tensorflow import keras
|
|
22 |
from keras import layers
|
23 |
import librosa
|
24 |
import speech_recognition as sr
|
25 |
-
|
26 |
# MODEL LOSS
|
27 |
def CTCLoss(y_true, y_pred):
|
28 |
# Compute the training-time loss value
|
@@ -129,7 +129,8 @@ def loadWeights():
|
|
129 |
output = "AudioToTextCKPT.hdf5"
|
130 |
|
131 |
# Download
|
132 |
-
|
|
|
133 |
|
134 |
# Load CKPT to Model
|
135 |
model.load_weights(output)
|
22 |
from keras import layers
|
23 |
import librosa
|
24 |
import speech_recognition as sr
|
25 |
+
from os.path import exists
|
26 |
# MODEL LOSS
|
27 |
def CTCLoss(y_true, y_pred):
|
28 |
# Compute the training-time loss value
|
129 |
output = "AudioToTextCKPT.hdf5"
|
130 |
|
131 |
# Download
|
132 |
+
if not exists("AudioToTextCKPT.hdf5"):
|
133 |
+
gdown.download(url = ckpt_link, output = output, quiet = False, fuzzy = True)
|
134 |
|
135 |
# Load CKPT to Model
|
136 |
model.load_weights(output)
|
TestTranslation/translation.py
CHANGED
@@ -19,6 +19,7 @@ from tensorflow.keras import layers
|
|
19 |
from tensorflow.keras.layers.experimental.preprocessing import TextVectorization
|
20 |
import os
|
21 |
import gdown
|
|
|
22 |
|
23 |
text_file = keras.utils.get_file(
|
24 |
fname = "spa-eng.zip",
|
@@ -253,7 +254,8 @@ transformer.summary()
|
|
253 |
|
254 |
# load weights using gdown
|
255 |
print(os.listdir())
|
256 |
-
|
|
|
257 |
transformer.load_weights("./EngToSpanishckpts/cp.ckpt")
|
258 |
|
259 |
spa_vocab = spa_vectorization.get_vocabulary()
|
19 |
from tensorflow.keras.layers.experimental.preprocessing import TextVectorization
|
20 |
import os
|
21 |
import gdown
|
22 |
+
from os.path import exists
|
23 |
|
24 |
text_file = keras.utils.get_file(
|
25 |
fname = "spa-eng.zip",
|
254 |
|
255 |
# load weights using gdown
|
256 |
print(os.listdir())
|
257 |
+
if not exists("./EngToSpanishckpts"):
|
258 |
+
gdown.download_folder("https://drive.google.com/drive/folders/1DwN-MlL6MMh7qVJbwoLrWBSMVBN5zbBi")
|
259 |
transformer.load_weights("./EngToSpanishckpts/cp.ckpt")
|
260 |
|
261 |
spa_vocab = spa_vectorization.get_vocabulary()
|
TestTranslationChinese/translation_model.py
CHANGED
@@ -17,11 +17,12 @@ import tensorflow as tf
|
|
17 |
from tensorflow import keras
|
18 |
from tensorflow.keras import layers
|
19 |
from tensorflow.keras.layers.experimental.preprocessing import TextVectorization
|
20 |
-
|
21 |
import gdown
|
22 |
|
23 |
-
|
24 |
-
|
|
|
25 |
|
26 |
with open('cmn.txt', encoding="utf-8") as f:
|
27 |
lines = f.read().split("\n")[:-1]
|
@@ -224,7 +225,8 @@ class TransformerDecoder(layers.Layer):
|
|
224 |
return config
|
225 |
|
226 |
url = "https://drive.google.com/uc?id=1a4eTAL4sLUi42P28Veihrv-fVPwFymTa"
|
227 |
-
|
|
|
228 |
|
229 |
custom_objects = {"TransformerEncoder": TransformerEncoder, "PositionalEmbedding": PositionalEmbedding, "TransformerDecoder": TransformerDecoder}
|
230 |
with keras.utils.custom_object_scope(custom_objects):
|
17 |
from tensorflow import keras
|
18 |
from tensorflow.keras import layers
|
19 |
from tensorflow.keras.layers.experimental.preprocessing import TextVectorization
|
20 |
+
from os.path import exists
|
21 |
import gdown
|
22 |
|
23 |
+
if not exists("cmn.txt"):
|
24 |
+
url = "https://drive.google.com/uc?id=1FOC2x5HlgcFTMgnGhPjvLWWlEqVTLQno"
|
25 |
+
gdown.download(url, quiet=False)
|
26 |
|
27 |
with open('cmn.txt', encoding="utf-8") as f:
|
28 |
lines = f.read().split("\n")[:-1]
|
225 |
return config
|
226 |
|
227 |
url = "https://drive.google.com/uc?id=1a4eTAL4sLUi42P28Veihrv-fVPwFymTa"
|
228 |
+
if not exists("re-model.h5"):
|
229 |
+
gdown.download(url, quiet=False)
|
230 |
|
231 |
custom_objects = {"TransformerEncoder": TransformerEncoder, "PositionalEmbedding": PositionalEmbedding, "TransformerDecoder": TransformerDecoder}
|
232 |
with keras.utils.custom_object_scope(custom_objects):
|
TextToAudio/test.py
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
import subprocess
|
2 |
-
|
3 |
-
subprocess.call('ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi')
|
4 |
-
|
5 |
-
print(subprocess.getoutput('nvidia-smi'))
|
|
|
|
|
|
|
|
|
|