alexandre-huynh commited on
Commit
fd2aa66
1 Parent(s): 6119fe5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -28,17 +28,17 @@ import keras_nlp
28
  import time
29
  import re
30
 
31
- os.environ["KERAS_BACKEND"] = "tensorflow" # or "tensorflow" or "torch"
32
 
33
- keras.mixed_precision.set_global_policy("mixed_float16")
34
 
35
- preprocessor = keras_nlp.models.GPT2CausalLMPreprocessor.from_preset(
36
- "gpt2_medium_en",
37
- sequence_length=128,
38
- )
39
- gpt2_lm = keras_nlp.models.GPT2CausalLM.from_preset(
40
- "gpt2_medium_en", preprocessor=preprocessor
41
- )
42
 
43
  #drive.mount('/content/drive', force_remount=True)
44
  # GPT2 Base 1 epochs
@@ -46,9 +46,11 @@ gpt2_lm = keras_nlp.models.GPT2CausalLM.from_preset(
46
  # GPT2 Base 3 epochs
47
  #checkpoint_path = "./aloqas_model_checkpoints_gpt2base_3_epochs/cp.ckpt"
48
  # GPT2 Base 3 epochs
49
- checkpoint_path = "./aloqas_model_checkpoints_gpt2medium_3_epochs/cp.ckpt"
50
 
51
- gpt2_lm.load_weights(checkpoint_path)
 
 
52
 
53
  """# Chargement et configuration de gradio"""
54
 
 
28
  import time
29
  import re
30
 
31
+ #os.environ["KERAS_BACKEND"] = "tensorflow" # or "tensorflow" or "torch"
32
 
33
+ #keras.mixed_precision.set_global_policy("mixed_float16")
34
 
35
+ #preprocessor = keras_nlp.models.GPT2CausalLMPreprocessor.from_preset(
36
+ # "gpt2_medium_en",
37
+ # sequence_length=128,
38
+ #)
39
+ #gpt2_lm = keras_nlp.models.GPT2CausalLM.from_preset(
40
+ # "gpt2_medium_en", preprocessor=preprocessor
41
+ #)
42
 
43
  #drive.mount('/content/drive', force_remount=True)
44
  # GPT2 Base 1 epochs
 
46
  # GPT2 Base 3 epochs
47
  #checkpoint_path = "./aloqas_model_checkpoints_gpt2base_3_epochs/cp.ckpt"
48
  # GPT2 Base 3 epochs
49
+ #checkpoint_path = "./aloqas_model_checkpoints_gpt2medium_3_epochs/cp.ckpt"
50
 
51
+ #gpt2_lm.load_weights(checkpoint_path)
52
+
53
+ gpt2_lm = keras.models.load_model("aloqas_model_keras_gpt2medium_3epochs/aloqas_model_gpt2medium_3_epochs.keras")
54
 
55
  """# Chargement et configuration de gradio"""
56