milyiyo commited on
Commit
ee1eb9b
1 Parent(s): bf1499f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -37
app.py CHANGED
@@ -85,43 +85,7 @@ def paraphrase(sentence: str, count: str):
85
  return {'result': []}
86
  sentence_input = sentence
87
  text = f"paraphrase: {sentence_input} </s>"
88
- # encoding = tokenizer.encode_plus(text, padding=True, return_tensors="pt")
89
  encoding = tokenizer(text, return_tensors="pt")
90
- # input_ids, attention_masks = encoding["input_ids"], encoding["attention_mask"]
91
-
92
- # outputs = model.generate(
93
- # input_ids=input_ids, attention_mask=attention_masks,
94
- # max_length=512, # 256,
95
- # do_sample=True,
96
- # top_k=120,
97
- # top_p=0.95,
98
- # early_stopping=True,
99
- # num_return_sequences=p_count
100
- # )
101
- # res = []
102
- # for output in outputs:
103
- # line = tokenizer.decode(
104
- # output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
105
- # res.append(line)
106
-
107
- # print(res)
108
-
109
- #
110
- # input_ids, attention_masks = encoding["input_ids"], encoding["attention_mask"]
111
- # outputs = model.generate(input_ids=input_ids,
112
- # attention_mask=attention_masks,
113
- # max_length=512,
114
- # do_sample=True,
115
- # top_k=120,
116
- # top_p=0.95,
117
- # early_stopping=True,
118
- # num_return_sequences=p_count)
119
- # result_v4 = []
120
- # for output in outputs:
121
- # line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
122
- # result_v4.append(line)
123
- #
124
-
125
  return {
126
  'result': {
127
  'generate_v1':generate_v1(encoding, p_count),
@@ -130,7 +94,8 @@ def paraphrase(sentence: str, count: str):
130
  'generate_v4':generate_v4(encoding, p_count)
131
  }
132
  }
133
-
 
134
  def paraphrase_dummy(sentence: str, count: str):
135
  return {'result': []}
136
 
 
85
  return {'result': []}
86
  sentence_input = sentence
87
  text = f"paraphrase: {sentence_input} </s>"
 
88
  encoding = tokenizer(text, return_tensors="pt")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  return {
90
  'result': {
91
  'generate_v1':generate_v1(encoding, p_count),
 
94
  'generate_v4':generate_v4(encoding, p_count)
95
  }
96
  }
97
+
98
+
99
  def paraphrase_dummy(sentence: str, count: str):
100
  return {'result': []}
101