Add epsilon_cutoff/eta_cutoff parameters (#2258)

This commit is contained in:
oobabooga 2023-05-21 15:11:57 -03:00 committed by GitHub
parent 767a767989
commit 8ac3636966
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 9 deletions

View file

@ -190,6 +190,10 @@ def generate_reply_HF(question, original_question, seed, state, eos_token=None,
for k in ['max_new_tokens', 'do_sample', 'temperature', 'top_p', 'typical_p', 'repetition_penalty', 'encoder_repetition_penalty', 'top_k', 'min_length', 'no_repeat_ngram_size', 'num_beams', 'penalty_alpha', 'length_penalty', 'early_stopping']:
generate_params[k] = state[k]
for k in ['epsilon_cutoff', 'eta_cutoff']:
if state[k] > 0:
generate_params[k] = state[k] * 1e-4
if state['ban_eos_token']:
generate_params['suppress_tokens'] = [shared.tokenizer.eos_token_id]