Automatically set wbits/groupsize/instruct based on model name (#1167)

This commit is contained in:
oobabooga 2023-04-14 11:07:28 -03:00 committed by GitHub
parent 9d66957207
commit 8e31f2bad4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 377 additions and 286 deletions

View file

@ -192,7 +192,7 @@ def generate_reply(question, state, eos_token=None, stopping_strings=[]):
# Handling the stopping strings
stopping_criteria_list = transformers.StoppingCriteriaList()
for st in [stopping_strings, state['custom_stopping_strings']]:
for st in [stopping_strings, eval(f"[{state['custom_stopping_strings']}]")]:
if type(st) is list and len(st) > 0:
sentinel_token_ids = [encode(string, add_special_tokens=False) for string in st]
stopping_criteria_list.append(_SentinelTokenStoppingCriteria(sentinel_token_ids=sentinel_token_ids, starting_idx=len(input_ids[0])))