Add "seed" menu in the Parameters tab
This commit is contained in:
parent
45b7e53565
commit
61346b88ea
6 changed files with 33 additions and 19 deletions
|
@ -93,8 +93,15 @@ def clear_torch_cache():
|
|||
if not shared.args.cpu:
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
def generate_reply(question, 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, eos_token=None, stopping_string=None):
|
||||
def set_manual_seed(seed):
|
||||
if seed != -1:
|
||||
torch.manual_seed(seed)
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.manual_seed_all(seed)
|
||||
|
||||
def generate_reply(question, 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, seed, eos_token=None, stopping_string=None):
|
||||
clear_torch_cache()
|
||||
set_manual_seed(seed)
|
||||
t0 = time.time()
|
||||
|
||||
# These models are not part of Hugging Face, so we handle them
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue