Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 =
|
50 |
-
input =
|
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}')
|