milyiyo commited on
Commit
990ed62
1 Parent(s): 7668825

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -58,12 +58,15 @@ def generate_v3(inputs, count):
58
  return sentences
59
 
60
 
61
- def generate_v4(inputs, count):
62
  """Generate text using a Diverse Beam Search strategy."""
63
- input_ids, attention_masks = inputs["input_ids"], inputs["attention_mask"]
 
 
 
64
  outputs = model.generate(input_ids=input_ids,
65
  attention_mask=attention_masks,
66
- max_length=512, # 256,
67
  do_sample=True,
68
  top_k=120,
69
  top_p=0.95,
@@ -109,10 +112,10 @@ def paraphrase(sentence: str, count: str):
109
 
110
  return {
111
  'result': {
112
- 'generate_v1':generate_v1(encoding, count),
113
- 'generate_v2':generate_v2(encoding, count),
114
- 'generate_v3':generate_v3(encoding, count),
115
- 'generate_v4':generate_v4(encoding, count),
116
  }
117
  }
118
 
 
58
  return sentences
59
 
60
 
61
+ def generate_v4(encoding, count):
62
  """Generate text using a Diverse Beam Search strategy."""
63
+ print(encoding)
64
+ input_ids, attention_masks = encoding["input_ids"], encoding["attention_mask"]
65
+ print(input_ids)
66
+ print(attention_masks)
67
  outputs = model.generate(input_ids=input_ids,
68
  attention_mask=attention_masks,
69
+ max_length=512,
70
  do_sample=True,
71
  top_k=120,
72
  top_p=0.95,
 
112
 
113
  return {
114
  'result': {
115
+ # 'generate_v1':generate_v1(encoding, count),
116
+ # 'generate_v2':generate_v2(encoding, count),
117
+ # 'generate_v3':generate_v3(encoding, count),
118
+ # 'generate_v4':generate_v4(encoding, count),
119
  }
120
  }
121