From c727a70572ec92e3ce47aa54be50a604250683a0 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 20 Dec 2023 19:18:07 -0800 Subject: [PATCH] Remove redundancy from modules/loaders.py --- modules/loaders.py | 201 +++------------------------------------------ 1 file changed, 13 insertions(+), 188 deletions(-) diff --git a/modules/loaders.py b/modules/loaders.py index cfab7dec..d8e268e9 100644 --- a/modules/loaders.py +++ b/modules/loaders.py @@ -168,8 +168,9 @@ loaders_and_params = OrderedDict({ ] }) -loaders_samplers = { - 'Transformers': { + +def transformers_samplers(): + return { 'temperature', 'temperature_last', 'top_p', @@ -205,7 +206,16 @@ loaders_samplers = { 'add_bos_token', 'skip_special_tokens', 'auto_max_new_tokens', - }, + } + + +loaders_samplers = { + 'Transformers': transformers_samplers(), + 'AutoGPTQ': transformers_samplers(), + 'GPTQ-for-LLaMa': transformers_samplers(), + 'AutoAWQ': transformers_samplers(), + 'QuIP#': transformers_samplers(), + 'HQQ': transformers_samplers(), 'ExLlama_HF': { 'temperature', 'temperature_last', @@ -306,80 +316,6 @@ loaders_samplers = { 'skip_special_tokens', 'auto_max_new_tokens', }, - 'AutoGPTQ': { - 'temperature', - 'temperature_last', - 'top_p', - 'min_p', - 'top_k', - 'typical_p', - 'epsilon_cutoff', - 'eta_cutoff', - 'tfs', - 'top_a', - 'repetition_penalty', - 'presence_penalty', - 'frequency_penalty', - 'repetition_penalty_range', - 'encoder_repetition_penalty', - 'no_repeat_ngram_size', - 'min_length', - 'seed', - 'do_sample', - 'penalty_alpha', - 'num_beams', - 'length_penalty', - 'early_stopping', - 'mirostat_mode', - 'mirostat_tau', - 'mirostat_eta', - 'grammar_file_row', - 'grammar_string', - 'guidance_scale', - 'negative_prompt', - 'ban_eos_token', - 'custom_token_bans', - 'add_bos_token', - 'skip_special_tokens', - 'auto_max_new_tokens', - }, - 'GPTQ-for-LLaMa': { - 'temperature', - 'temperature_last', - 'top_p', - 'min_p', - 'top_k', - 'typical_p', - 'epsilon_cutoff', - 'eta_cutoff', - 'tfs', - 'top_a', - 'repetition_penalty', - 'presence_penalty', - 'frequency_penalty', - 'repetition_penalty_range', - 'encoder_repetition_penalty', - 'no_repeat_ngram_size', - 'min_length', - 'seed', - 'do_sample', - 'penalty_alpha', - 'num_beams', - 'length_penalty', - 'early_stopping', - 'mirostat_mode', - 'mirostat_tau', - 'mirostat_eta', - 'grammar_file_row', - 'grammar_string', - 'guidance_scale', - 'negative_prompt', - 'ban_eos_token', - 'custom_token_bans', - 'add_bos_token', - 'skip_special_tokens', - 'auto_max_new_tokens', - }, 'llama.cpp': { 'temperature', 'top_p', @@ -439,117 +375,6 @@ loaders_samplers = { 'repetition_penalty', 'repetition_penalty_range', }, - 'AutoAWQ': { - 'temperature', - 'temperature_last', - 'top_p', - 'min_p', - 'top_k', - 'typical_p', - 'epsilon_cutoff', - 'eta_cutoff', - 'tfs', - 'top_a', - 'repetition_penalty', - 'presence_penalty', - 'frequency_penalty', - 'repetition_penalty_range', - 'encoder_repetition_penalty', - 'no_repeat_ngram_size', - 'min_length', - 'seed', - 'do_sample', - 'penalty_alpha', - 'num_beams', - 'length_penalty', - 'early_stopping', - 'mirostat_mode', - 'mirostat_tau', - 'mirostat_eta', - 'grammar_file_row', - 'grammar_string', - 'guidance_scale', - 'negative_prompt', - 'ban_eos_token', - 'custom_token_bans', - 'add_bos_token', - 'skip_special_tokens', - 'auto_max_new_tokens', - }, - 'QuIP#': { - 'temperature', - 'temperature_last', - 'top_p', - 'min_p', - 'top_k', - 'typical_p', - 'epsilon_cutoff', - 'eta_cutoff', - 'tfs', - 'top_a', - 'repetition_penalty', - 'presence_penalty', - 'frequency_penalty', - 'repetition_penalty_range', - 'encoder_repetition_penalty', - 'no_repeat_ngram_size', - 'min_length', - 'seed', - 'do_sample', - 'penalty_alpha', - 'num_beams', - 'length_penalty', - 'early_stopping', - 'mirostat_mode', - 'mirostat_tau', - 'mirostat_eta', - 'grammar_file_row', - 'grammar_string', - 'guidance_scale', - 'negative_prompt', - 'ban_eos_token', - 'custom_token_bans', - 'add_bos_token', - 'skip_special_tokens', - 'auto_max_new_tokens', - }, - 'HQQ': { - 'temperature', - 'temperature_last', - 'top_p', - 'min_p', - 'top_k', - 'typical_p', - 'epsilon_cutoff', - 'eta_cutoff', - 'tfs', - 'top_a', - 'repetition_penalty', - 'presence_penalty', - 'frequency_penalty', - 'repetition_penalty_range', - 'encoder_repetition_penalty', - 'no_repeat_ngram_size', - 'min_length', - 'seed', - 'do_sample', - 'penalty_alpha', - 'num_beams', - 'length_penalty', - 'early_stopping', - 'mirostat_mode', - 'mirostat_tau', - 'mirostat_eta', - 'grammar_file_row', - 'grammar_string', - 'guidance_scale', - 'negative_prompt', - 'ban_eos_token', - 'custom_token_bans', - 'add_bos_token', - 'skip_special_tokens', - 'auto_max_new_tokens', - }, } loaders_model_types = {