Spaces:
Runtime error
Runtime error
Commit
·
46c7b1e
1
Parent(s):
107315a
Update app.py
Browse files
app.py
CHANGED
@@ -7,28 +7,34 @@ from tensorflow import keras
|
|
7 |
import time
|
8 |
|
9 |
def download_model_NLP():
|
10 |
-
preprocessor = keras_nlp.models.GPT2CausalLMPreprocessor.from_preset(
|
11 |
-
"gpt2_base_en",
|
12 |
-
sequence_length=128,)
|
13 |
-
model = keras_nlp.models.GPT2CausalLM.from_preset(
|
14 |
-
"gpt2_base_en", preprocessor=preprocessor)
|
15 |
|
16 |
|
17 |
-
output = "GPT2_keras_deer"
|
18 |
-
id_weights = "106fk9vGF_sHB8St9B2cKYE9jQVNSdKW_"
|
19 |
-
gdown.download(id=id_weights, output=output, quiet=False)
|
20 |
|
21 |
-
id_index = "10EWM2kJG4djpI5T6VLuj0UkGCbVIjmJx"
|
22 |
-
gdown.download(id=id_index, output=output, quiet=False)
|
23 |
|
24 |
-
id_check_point = "10Et7a0EzyrnnBhMWzt6frXLiNVm8a2qz"
|
25 |
-
gdown.download(id=id_check_point, output=output, quiet=False)
|
26 |
|
27 |
#id_folder = "1zi3hSBRTP9uwHDVwQMqpGeXb8RBhJfrO"
|
28 |
#gdown.download_folder(id=id_folder, quiet=True, use_cookies=False)
|
29 |
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
return model
|
34 |
|
|
|
7 |
import time
|
8 |
|
9 |
def download_model_NLP():
|
10 |
+
#preprocessor = keras_nlp.models.GPT2CausalLMPreprocessor.from_preset(
|
11 |
+
#"gpt2_base_en",
|
12 |
+
#sequence_length=128,)
|
13 |
+
#model = keras_nlp.models.GPT2CausalLM.from_preset(
|
14 |
+
#"gpt2_base_en", preprocessor=preprocessor)
|
15 |
|
16 |
|
17 |
+
#output = "GPT2_keras_deer"
|
18 |
+
#id_weights = "106fk9vGF_sHB8St9B2cKYE9jQVNSdKW_"
|
19 |
+
#gdown.download(id=id_weights, output=output, quiet=False)
|
20 |
|
21 |
+
#id_index = "10EWM2kJG4djpI5T6VLuj0UkGCbVIjmJx"
|
22 |
+
#gdown.download(id=id_index, output=output, quiet=False)
|
23 |
|
24 |
+
#id_check_point = "10Et7a0EzyrnnBhMWzt6frXLiNVm8a2qz"
|
25 |
+
#gdown.download(id=id_check_point, output=output, quiet=False)
|
26 |
|
27 |
#id_folder = "1zi3hSBRTP9uwHDVwQMqpGeXb8RBhJfrO"
|
28 |
#gdown.download_folder(id=id_folder, quiet=True, use_cookies=False)
|
29 |
|
30 |
+
output = "123.h5"
|
31 |
+
id = "1-CiBtOhzyVuiUGShONZqluey7TyX9-Y6"
|
32 |
+
gdown.download(id=id, output=output, quiet=False)
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
#model.load_weights(output
|
37 |
+
model = tf.keras.models.load_model(output)
|
38 |
|
39 |
return model
|
40 |
|