Spaces:
Runtime error
Runtime error
pseudotensor
commited on
Commit
•
afada69
1
Parent(s):
31f9cfa
Update with h2oGPT hash f06eaae17d5d0c548fd962288427b535048b47f3
Browse files- generate.py +7 -4
generate.py
CHANGED
@@ -4,7 +4,7 @@ import os
|
|
4 |
import traceback
|
5 |
import typing
|
6 |
from threading import Thread
|
7 |
-
|
8 |
import filelock
|
9 |
import psutil
|
10 |
|
@@ -114,7 +114,7 @@ def main(
|
|
114 |
|
115 |
if is_public:
|
116 |
input_lines = 1 # ensure set, for ease of use
|
117 |
-
temperature = 0.
|
118 |
top_p = 0.85
|
119 |
top_k = 70
|
120 |
do_sample = True
|
@@ -834,7 +834,10 @@ def evaluate(
|
|
834 |
# https://github.com/h2oai/h2ogpt/issues/104
|
835 |
# but only makes sense if concurrency_count == 1
|
836 |
context_class = NullContext if concurrency_count > 1 else filelock.FileLock
|
|
|
|
|
837 |
with context_class("generate.lock"):
|
|
|
838 |
# decoded tokenized prompt can deviate from prompt due to special characters
|
839 |
inputs_decoded = decoder(input_ids[0])
|
840 |
inputs_decoded_raw = decoder_raw(input_ids[0])
|
@@ -850,7 +853,6 @@ def evaluate(
|
|
850 |
decoder = decoder_raw
|
851 |
else:
|
852 |
print("WARNING: Special characters in prompt", flush=True)
|
853 |
-
decoded_output = None
|
854 |
if stream_output:
|
855 |
skip_prompt = False
|
856 |
streamer = TextIteratorStreamer(tokenizer, skip_prompt=skip_prompt)
|
@@ -875,6 +877,7 @@ def evaluate(
|
|
875 |
decoded_output = prompt + outputs[0]
|
876 |
if save_dir and decoded_output:
|
877 |
save_generate_output(output=decoded_output, base_model=base_model, save_dir=save_dir)
|
|
|
878 |
|
879 |
|
880 |
def generate_with_exceptions(func, prompt, inputs_decoded, raise_generate_gpu_exceptions, **kwargs):
|
@@ -1017,7 +1020,7 @@ Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-pa
|
|
1017 |
num_return_sequences = min(num_beams, num_return_sequences or 1)
|
1018 |
do_sample = False if do_sample is None else do_sample
|
1019 |
else:
|
1020 |
-
temperature = 0.
|
1021 |
top_p = 0.85 if top_p is None else top_p
|
1022 |
top_k = 70 if top_k is None else top_k
|
1023 |
if chat:
|
|
|
4 |
import traceback
|
5 |
import typing
|
6 |
from threading import Thread
|
7 |
+
from datetime import datetime
|
8 |
import filelock
|
9 |
import psutil
|
10 |
|
|
|
114 |
|
115 |
if is_public:
|
116 |
input_lines = 1 # ensure set, for ease of use
|
117 |
+
temperature = 0.2
|
118 |
top_p = 0.85
|
119 |
top_k = 70
|
120 |
do_sample = True
|
|
|
834 |
# https://github.com/h2oai/h2ogpt/issues/104
|
835 |
# but only makes sense if concurrency_count == 1
|
836 |
context_class = NullContext if concurrency_count > 1 else filelock.FileLock
|
837 |
+
print('Pre-Generate: %s' % str(datetime.now()), flush=True)
|
838 |
+
decoded_output = None
|
839 |
with context_class("generate.lock"):
|
840 |
+
print('Generate: %s' % str(datetime.now()), flush=True)
|
841 |
# decoded tokenized prompt can deviate from prompt due to special characters
|
842 |
inputs_decoded = decoder(input_ids[0])
|
843 |
inputs_decoded_raw = decoder_raw(input_ids[0])
|
|
|
853 |
decoder = decoder_raw
|
854 |
else:
|
855 |
print("WARNING: Special characters in prompt", flush=True)
|
|
|
856 |
if stream_output:
|
857 |
skip_prompt = False
|
858 |
streamer = TextIteratorStreamer(tokenizer, skip_prompt=skip_prompt)
|
|
|
877 |
decoded_output = prompt + outputs[0]
|
878 |
if save_dir and decoded_output:
|
879 |
save_generate_output(output=decoded_output, base_model=base_model, save_dir=save_dir)
|
880 |
+
print('Post-Generate: %s decoded_output: %s' % (str(datetime.now()), len(decoded_output) if decoded_output else -1), flush=True)
|
881 |
|
882 |
|
883 |
def generate_with_exceptions(func, prompt, inputs_decoded, raise_generate_gpu_exceptions, **kwargs):
|
|
|
1020 |
num_return_sequences = min(num_beams, num_return_sequences or 1)
|
1021 |
do_sample = False if do_sample is None else do_sample
|
1022 |
else:
|
1023 |
+
temperature = 0.2 if temperature is None else temperature
|
1024 |
top_p = 0.85 if top_p is None else top_p
|
1025 |
top_k = 70 if top_k is None else top_k
|
1026 |
if chat:
|