BlinkDL commited on
Commit
a37b05a
·
1 Parent(s): 9770736

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -46,8 +46,8 @@ def evaluate(
46
  token_ban = [], # ban the generation of some tokens
47
  token_stop = [0]) # stop generation whenever you see any token here
48
 
49
- instruction = instruction.strip().replace('\r\n','\n').replace('\n\n','\n').replace('\n\n','\n')
50
- input = input.strip().replace('\r\n','\n').replace('\n\n','\n').replace('\n\n','\n')
51
  ctx = generate_prompt(instruction, input)
52
 
53
  all_tokens = []
@@ -76,6 +76,8 @@ def evaluate(
76
  out_str += tmp
77
  yield out_str.strip()
78
  out_last = i + 1
 
 
79
 
80
  gpu_info = nvmlDeviceGetMemoryInfo(gpu_h)
81
  print(f'vram {gpu_info.total} used {gpu_info.used} free {gpu_info.free}')
 
46
  token_ban = [], # ban the generation of some tokens
47
  token_stop = [0]) # stop generation whenever you see any token here
48
 
49
+ instruction = re.sub(r'\n{2,}', '\n', instruction).strip().replace('\r\n','\n')
50
+ input = re.sub(r'\n{2,}', '\n', input).strip().replace('\r\n','\n')
51
  ctx = generate_prompt(instruction, input)
52
 
53
  all_tokens = []
 
76
  out_str += tmp
77
  yield out_str.strip()
78
  out_last = i + 1
79
+ if '\n\n' in tmp:
80
+ break
81
 
82
  gpu_info = nvmlDeviceGetMemoryInfo(gpu_h)
83
  print(f'vram {gpu_info.total} used {gpu_info.used} free {gpu_info.free}')