vinayakdev commited on
Commit
0074c68
1 Parent(s): bef439a

Happy Hugging Face!

Browse files
Files changed (2) hide show
  1. gene +0 -0
  2. generator.py +12 -5
gene DELETED
File without changes
generator.py CHANGED
@@ -29,9 +29,11 @@ import pickle
29
  # sq_tokenizer = att.from_pretrained("mrm8488/t5-base-finetuned-question-generation-ap")
30
  # sq_model = alwm.from_pretrained("mrm8488/t5-base-finetuned-question-generation-ap")
31
  # 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."
32
- hftokenizer = pickle.load(open('models/hftokenizer.sav', 'rb'))
33
- hfmodel = pickle.load(open('models/hfmodel.sav', 'rb'))
 
34
 
 
35
  def run_model(input_string, **generator_args):
36
  generator_args = {
37
  "max_length": 256,
@@ -47,9 +49,14 @@ def run_model(input_string, **generator_args):
47
  output = hftokenizer.batch_decode(res, skip_special_tokens=True)
48
  output = [item.split("<sep>") for item in output]
49
  return output
50
-
51
- al_model = pickle.load(open('models/al_model.sav', 'rb'))
52
- al_tokenizer = pickle.load(open('models/al_tokenizer.sav', 'rb'))
 
 
 
 
 
53
  def QA(question, context):
54
  # model_name="deepset/electra-base-squad2"
55
  nlp = pipeline("question-answering",model=al_model,tokenizer=al_tokenizer)
 
29
  # sq_tokenizer = att.from_pretrained("mrm8488/t5-base-finetuned-question-generation-ap")
30
  # sq_model = alwm.from_pretrained("mrm8488/t5-base-finetuned-question-generation-ap")
31
  # 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."
32
+ # hftokenizer = pickle.load(open('models/hftokenizer.sav', 'rb'))
33
+ # hfmodel = pickle.load(open('models/hfmodel.sav', 'rb'))
34
+ hfmodel = alwm.from_pretrained("valhalla/t5-small-e2e-qg")
35
 
36
+ hftokenizer = T5TokenizerFast.from_pretrained("t5-small")
37
  def run_model(input_string, **generator_args):
38
  generator_args = {
39
  "max_length": 256,
 
49
  output = hftokenizer.batch_decode(res, skip_special_tokens=True)
50
  output = [item.split("<sep>") for item in output]
51
  return output
52
+
53
+
54
+
55
+ al_tokenizer = att.from_pretrained("deepset/electra-base-squad2")
56
+ al_model = amqa.from_pretrained("deepset/electra-base-squad2")
57
+
58
+ # al_model = pickle.load(open('models/al_model.sav', 'rb'))
59
+ # al_tokenizer = pickle.load(open('models/al_tokenizer.sav', 'rb'))
60
  def QA(question, context):
61
  # model_name="deepset/electra-base-squad2"
62
  nlp = pipeline("question-answering",model=al_model,tokenizer=al_tokenizer)