vinayakdev commited on
Commit
15291b0
1 Parent(s): 4fcc60e

Load from pickle modules

Browse files
Files changed (1) hide show
  1. generator.py +4 -6
generator.py CHANGED
@@ -33,16 +33,14 @@ import streamlit as st
33
  # text= "The abolition of feudal privileges by the National Constituent Assembly on 4 August 1789 and the Declaration \\nof the Rights of Man and of the Citizen (La Déclaration des Droits de l'Homme et du Citoyen), drafted by Lafayette \\nwith the help of Thomas Jefferson and adopted on 26 August, paved the way to a Constitutional Monarchy \\n(4 September 1791 – 21 September 1792). Despite these dramatic changes, life at the court continued, while the situation \\nin Paris was becoming critical because of bread shortages in September. On 5 October 1789, a crowd from Paris descended upon Versailles \\nand forced the royal family to move to the Tuileries Palace in Paris, where they lived under a form of house arrest under \\nthe watch of Lafayette's Garde Nationale, while the Comte de Provence and his wife were allowed to reside in the \\nPetit Luxembourg, where they remained until they went into exile on 20 June 1791."
34
  # hftokenizer = pickle.load(open('models/hftokenizer.sav', 'rb'))
35
  # hfmodel = pickle.load(open('models/hfmodel.sav', 'rb'))
36
- @st.cache
37
  def load_model():
38
- hfm = alwm.from_pretrained("ThomasSimonini/t5-end2end-question-generation")
39
  hft = T5TokenizerFast.from_pretrained("t5-base")
40
  tok = att.from_pretrained("ahotrod/albert_xxlargev1_squad2_512")
41
- model = amqa.from_pretrained("ahotrod/albert_xxlargev1_squad2_512")
42
- pickle.dump(model, open('model.sav', 'wb'))
43
- pickle.dump(hfm, open('hfmodel.sav', 'wb'))
44
-
45
  return hfm, hft,tok, model
 
46
  hfmodel, hftokenizer, tokenizer, model = load_model()
47
 
48
  def run_model(input_string, **generator_args):
 
33
  # text= "The abolition of feudal privileges by the National Constituent Assembly on 4 August 1789 and the Declaration \\nof the Rights of Man and of the Citizen (La Déclaration des Droits de l'Homme et du Citoyen), drafted by Lafayette \\nwith the help of Thomas Jefferson and adopted on 26 August, paved the way to a Constitutional Monarchy \\n(4 September 1791 – 21 September 1792). Despite these dramatic changes, life at the court continued, while the situation \\nin Paris was becoming critical because of bread shortages in September. On 5 October 1789, a crowd from Paris descended upon Versailles \\nand forced the royal family to move to the Tuileries Palace in Paris, where they lived under a form of house arrest under \\nthe watch of Lafayette's Garde Nationale, while the Comte de Provence and his wife were allowed to reside in the \\nPetit Luxembourg, where they remained until they went into exile on 20 June 1791."
34
  # hftokenizer = pickle.load(open('models/hftokenizer.sav', 'rb'))
35
  # hfmodel = pickle.load(open('models/hfmodel.sav', 'rb'))
36
+
37
  def load_model():
38
+ hfm = pickle.load(open('hfmodel.sav','rb'))
39
  hft = T5TokenizerFast.from_pretrained("t5-base")
40
  tok = att.from_pretrained("ahotrod/albert_xxlargev1_squad2_512")
41
+ model = pickle.load(open('model.sav','rb'))
 
 
 
42
  return hfm, hft,tok, model
43
+
44
  hfmodel, hftokenizer, tokenizer, model = load_model()
45
 
46
  def run_model(input_string, **generator_args):