patent commited on
Commit
44f71b0
·
verified ·
1 Parent(s): 11ffd87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -9,10 +9,10 @@ import requests
9
  import os
10
  import glob
11
  import re
12
- import smart_open
13
  import plotly.express as px
14
  import random
15
- import difflib
16
  import pdb
17
 
18
  from sentence_transformers import SentenceTransformer, models, util
@@ -73,14 +73,14 @@ first_claim_only = True
73
 
74
  ignore_outscope = True # ignore pick > 10
75
 
76
- def show_diff(a, b):
77
- #print('{} => {}'.format(a,b))
78
- for i, s in enumerate(difflib.ndiff(a, b)):
79
- if s[0]==' ': continue
80
- elif s[0]=='-':
81
- print(u'Delete "{}" from position {}'.format(s[-1],i))
82
- elif s[0]=='+':
83
- print(u'Add "{}" to position {}'.format(s[-1],i))
84
 
85
  def handle_char_return(text):
86
  if text == '(none)': # unicorn text
@@ -490,7 +490,7 @@ print('loading SentenceTransformer: %s' % sent_model)
490
  sent_aipd = SentenceTransformer(sent_model)
491
 
492
  def load_data(demo):
493
- fn = 'ppo_open_llama_3b_v2.run.12.delta.txt'
494
  with open(fn, 'r') as f:
495
  rows = json.load(f)
496
 
 
9
  import os
10
  import glob
11
  import re
12
+ #import smart_open
13
  import plotly.express as px
14
  import random
15
+ #import difflib
16
  import pdb
17
 
18
  from sentence_transformers import SentenceTransformer, models, util
 
73
 
74
  ignore_outscope = True # ignore pick > 10
75
 
76
+ # def show_diff(a, b):
77
+ # #print('{} => {}'.format(a,b))
78
+ # for i, s in enumerate(difflib.ndiff(a, b)):
79
+ # if s[0]==' ': continue
80
+ # elif s[0]=='-':
81
+ # print(u'Delete "{}" from position {}'.format(s[-1],i))
82
+ # elif s[0]=='+':
83
+ # print(u'Add "{}" to position {}'.format(s[-1],i))
84
 
85
  def handle_char_return(text):
86
  if text == '(none)': # unicorn text
 
490
  sent_aipd = SentenceTransformer(sent_model)
491
 
492
  def load_data(demo):
493
+ fn = 'ppo_output/ppo_open_llama_3b_v2.run.12.delta.txt'
494
  with open(fn, 'r') as f:
495
  rows = json.load(f)
496