Add debug preset (deterministic, should always give the same responses)

This commit is contained in:
oobabooga 2023-01-23 13:36:01 -03:00
parent 5b60691367
commit 4820379139
2 changed files with 5 additions and 3 deletions

View File

@ -0,0 +1,2 @@
do_sample=False,
max_new_tokens=tokens,

View File

@ -136,11 +136,11 @@ def fix_galactica(s):
return s return s
def encode(prompt, tokens): 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() torch.cuda.empty_cache()
input_ids = tokenizer.encode(str(prompt), return_tensors='pt', truncation=True, max_length=2048-tokens).cuda() 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 return input_ids
def decode(output_ids): def decode(output_ids):