From 4820379139dc4176fcf9057107d6a09374ef3d93 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:36:01 -0300 Subject: [PATCH] Add debug preset (deterministic, should always give the same responses) --- presets/Debug-deterministic.txt | 2 ++ server.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 presets/Debug-deterministic.txt diff --git a/presets/Debug-deterministic.txt b/presets/Debug-deterministic.txt new file mode 100644 index 00000000..daad9ee6 --- /dev/null +++ b/presets/Debug-deterministic.txt @@ -0,0 +1,2 @@ +do_sample=False, +max_new_tokens=tokens, diff --git a/server.py b/server.py index 62755264..c6760405 100644 --- a/server.py +++ b/server.py @@ -136,11 +136,11 @@ def fix_galactica(s): return s def encode(prompt, tokens): - if not args.cpu: + if args.cpu: + input_ids = tokenizer.encode(str(prompt), return_tensors='pt', truncation=True, max_length=2048-tokens) + else: torch.cuda.empty_cache() input_ids = tokenizer.encode(str(prompt), return_tensors='pt', truncation=True, max_length=2048-tokens).cuda() - else: - input_ids = tokenizer.encode(str(prompt), return_tensors='pt', truncation=True, max_length=2048-tokens) return input_ids def decode(output_ids):