2023-06-16 19:00:37 -03:00
|
|
|
import functools
|
2023-08-11 17:41:33 +00:00
|
|
|
from collections import OrderedDict
|
2023-06-16 19:00:37 -03:00
|
|
|
|
|
|
|
import gradio as gr
|
|
|
|
|
|
|
|
from modules import shared
|
|
|
|
|
2023-08-11 17:41:33 +00:00
|
|
|
loaders_and_params = OrderedDict({
|
|
|
|
'Transformers': [
|
|
|
|
'cpu_memory',
|
|
|
|
'gpu_memory',
|
|
|
|
'trust_remote_code',
|
|
|
|
'load_in_8bit',
|
|
|
|
'bf16',
|
|
|
|
'cpu',
|
|
|
|
'disk',
|
|
|
|
'auto_devices',
|
|
|
|
'load_in_4bit',
|
|
|
|
'use_double_quant',
|
|
|
|
'quant_type',
|
|
|
|
'compute_dtype',
|
|
|
|
'trust_remote_code',
|
2023-09-25 12:19:43 -07:00
|
|
|
'use_fast',
|
2023-08-11 17:41:33 +00:00
|
|
|
'alpha_value',
|
2023-08-25 06:53:37 -07:00
|
|
|
'rope_freq_base',
|
2023-08-11 17:41:33 +00:00
|
|
|
'compress_pos_emb',
|
2023-09-24 20:03:11 -07:00
|
|
|
'disable_exllama',
|
2023-08-11 17:41:33 +00:00
|
|
|
'transformers_info'
|
|
|
|
],
|
|
|
|
'ExLlama_HF': [
|
|
|
|
'gpu_split',
|
|
|
|
'max_seq_len',
|
|
|
|
'alpha_value',
|
2023-08-25 06:53:37 -07:00
|
|
|
'rope_freq_base',
|
2023-08-11 17:41:33 +00:00
|
|
|
'compress_pos_emb',
|
2023-08-24 16:27:36 -03:00
|
|
|
'cfg_cache',
|
2023-09-25 12:19:43 -07:00
|
|
|
'use_fast',
|
2023-08-11 17:41:33 +00:00
|
|
|
'exllama_HF_info',
|
|
|
|
],
|
2023-09-12 15:05:21 -07:00
|
|
|
'ExLlamav2_HF': [
|
2023-08-11 17:41:33 +00:00
|
|
|
'gpu_split',
|
|
|
|
'max_seq_len',
|
2023-09-12 15:05:21 -07:00
|
|
|
'cfg_cache',
|
2023-08-11 17:41:33 +00:00
|
|
|
'alpha_value',
|
|
|
|
'compress_pos_emb',
|
2023-09-25 12:19:43 -07:00
|
|
|
'use_fast',
|
2023-08-11 17:41:33 +00:00
|
|
|
],
|
2023-09-12 15:05:21 -07:00
|
|
|
'ExLlama': [
|
2023-09-12 14:33:07 -03:00
|
|
|
'gpu_split',
|
|
|
|
'max_seq_len',
|
2023-09-12 15:02:47 -07:00
|
|
|
'alpha_value',
|
2023-09-12 15:05:21 -07:00
|
|
|
'rope_freq_base',
|
2023-09-12 15:02:47 -07:00
|
|
|
'compress_pos_emb',
|
2023-09-12 15:05:21 -07:00
|
|
|
'exllama_info',
|
2023-09-12 14:33:07 -03:00
|
|
|
],
|
2023-09-12 15:05:21 -07:00
|
|
|
'ExLlamav2': [
|
2023-09-12 14:33:07 -03:00
|
|
|
'gpu_split',
|
|
|
|
'max_seq_len',
|
2023-09-12 15:02:47 -07:00
|
|
|
'alpha_value',
|
|
|
|
'compress_pos_emb',
|
2023-09-12 14:33:07 -03:00
|
|
|
],
|
2023-06-16 19:00:37 -03:00
|
|
|
'AutoGPTQ': [
|
|
|
|
'triton',
|
|
|
|
'no_inject_fused_attention',
|
|
|
|
'no_inject_fused_mlp',
|
2023-06-23 12:22:56 -03:00
|
|
|
'no_use_cuda_fp16',
|
2023-06-16 19:00:37 -03:00
|
|
|
'wbits',
|
|
|
|
'groupsize',
|
|
|
|
'desc_act',
|
2023-08-12 02:26:58 -04:00
|
|
|
'disable_exllama',
|
2023-06-16 19:00:37 -03:00
|
|
|
'gpu_memory',
|
|
|
|
'cpu_memory',
|
|
|
|
'cpu',
|
|
|
|
'disk',
|
|
|
|
'auto_devices',
|
|
|
|
'trust_remote_code',
|
2023-09-25 12:19:43 -07:00
|
|
|
'use_fast',
|
2023-06-16 19:00:37 -03:00
|
|
|
'autogptq_info',
|
|
|
|
],
|
|
|
|
'GPTQ-for-LLaMa': [
|
|
|
|
'wbits',
|
|
|
|
'groupsize',
|
|
|
|
'model_type',
|
|
|
|
'pre_layer',
|
2023-09-25 12:19:43 -07:00
|
|
|
'use_fast',
|
2023-06-16 19:00:37 -03:00
|
|
|
'gptq_for_llama_info',
|
|
|
|
],
|
|
|
|
'llama.cpp': [
|
|
|
|
'n_ctx',
|
|
|
|
'n_gpu_layers',
|
2023-08-18 12:03:34 -03:00
|
|
|
'tensor_split',
|
2023-06-16 19:00:37 -03:00
|
|
|
'n_batch',
|
|
|
|
'threads',
|
2023-10-01 21:27:04 -07:00
|
|
|
'threads_batch',
|
2023-06-16 19:00:37 -03:00
|
|
|
'no_mmap',
|
|
|
|
'mlock',
|
2023-10-22 12:22:06 -07:00
|
|
|
'no_mul_mat_q',
|
2023-06-16 19:00:37 -03:00
|
|
|
'llama_cpp_seed',
|
2023-07-18 03:32:37 +02:00
|
|
|
'alpha_value',
|
2023-08-25 06:53:37 -07:00
|
|
|
'rope_freq_base',
|
2023-08-08 21:24:28 -07:00
|
|
|
'compress_pos_emb',
|
2023-08-03 11:00:36 -03:00
|
|
|
'cpu',
|
2023-09-27 03:05:00 +02:00
|
|
|
'numa',
|
2023-06-16 19:00:37 -03:00
|
|
|
],
|
2023-07-16 02:21:13 -03:00
|
|
|
'llamacpp_HF': [
|
|
|
|
'n_ctx',
|
|
|
|
'n_gpu_layers',
|
2023-08-18 12:03:34 -03:00
|
|
|
'tensor_split',
|
2023-07-16 02:21:13 -03:00
|
|
|
'n_batch',
|
|
|
|
'threads',
|
2023-10-01 21:27:04 -07:00
|
|
|
'threads_batch',
|
2023-07-16 02:21:13 -03:00
|
|
|
'no_mmap',
|
|
|
|
'mlock',
|
2023-10-22 12:22:06 -07:00
|
|
|
'no_mul_mat_q',
|
2023-07-18 03:32:37 +02:00
|
|
|
'alpha_value',
|
2023-08-25 06:53:37 -07:00
|
|
|
'rope_freq_base',
|
2023-08-08 21:24:28 -07:00
|
|
|
'compress_pos_emb',
|
2023-08-03 11:00:36 -03:00
|
|
|
'cpu',
|
2023-09-27 03:05:00 +02:00
|
|
|
'numa',
|
2023-08-24 20:32:21 -03:00
|
|
|
'cfg_cache',
|
2023-09-25 12:19:43 -07:00
|
|
|
'use_fast',
|
2023-07-16 02:21:13 -03:00
|
|
|
'llamacpp_HF_info',
|
|
|
|
],
|
2023-08-11 17:41:33 +00:00
|
|
|
'ctransformers': [
|
2023-08-13 22:09:03 -04:00
|
|
|
'n_ctx',
|
2023-08-11 17:41:33 +00:00
|
|
|
'n_gpu_layers',
|
|
|
|
'n_batch',
|
|
|
|
'threads',
|
2023-08-22 19:51:34 +00:00
|
|
|
'model_type',
|
|
|
|
'no_mmap',
|
|
|
|
'mlock'
|
2023-10-05 16:19:18 +00:00
|
|
|
],
|
|
|
|
'AutoAWQ': [
|
|
|
|
'cpu_memory',
|
|
|
|
'gpu_memory',
|
|
|
|
'auto_devices',
|
|
|
|
'max_seq_len',
|
|
|
|
'n_batch',
|
|
|
|
'no_inject_fused_attention',
|
|
|
|
'trust_remote_code',
|
|
|
|
'use_fast',
|
2023-06-16 20:35:38 -03:00
|
|
|
]
|
2023-08-11 17:41:33 +00:00
|
|
|
})
|
2023-06-16 19:00:37 -03:00
|
|
|
|
2023-07-31 18:44:00 -07:00
|
|
|
loaders_samplers = {
|
|
|
|
'Transformers': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'typical_p',
|
|
|
|
'epsilon_cutoff',
|
|
|
|
'eta_cutoff',
|
|
|
|
'tfs',
|
|
|
|
'top_a',
|
|
|
|
'repetition_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',
|
2023-10-05 10:01:36 -03:00
|
|
|
'grammar_file_row',
|
|
|
|
'grammar_string',
|
2023-08-06 17:22:48 -03:00
|
|
|
'guidance_scale',
|
|
|
|
'negative_prompt',
|
2023-07-31 18:44:00 -07:00
|
|
|
'ban_eos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-07-31 18:44:00 -07:00
|
|
|
'add_bos_token',
|
|
|
|
'skip_special_tokens',
|
2023-08-02 14:52:20 -03:00
|
|
|
'auto_max_new_tokens',
|
2023-07-31 18:44:00 -07:00
|
|
|
},
|
|
|
|
'ExLlama_HF': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'typical_p',
|
|
|
|
'epsilon_cutoff',
|
|
|
|
'eta_cutoff',
|
|
|
|
'tfs',
|
|
|
|
'top_a',
|
|
|
|
'repetition_penalty',
|
|
|
|
'repetition_penalty_range',
|
|
|
|
'encoder_repetition_penalty',
|
|
|
|
'no_repeat_ngram_size',
|
|
|
|
'min_length',
|
|
|
|
'seed',
|
|
|
|
'do_sample',
|
|
|
|
'mirostat_mode',
|
|
|
|
'mirostat_tau',
|
|
|
|
'mirostat_eta',
|
2023-10-05 10:01:36 -03:00
|
|
|
'grammar_file_row',
|
|
|
|
'grammar_string',
|
2023-08-24 16:27:36 -03:00
|
|
|
'guidance_scale',
|
|
|
|
'negative_prompt',
|
2023-07-31 18:44:00 -07:00
|
|
|
'ban_eos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-07-31 18:44:00 -07:00
|
|
|
'add_bos_token',
|
|
|
|
'skip_special_tokens',
|
2023-08-02 14:52:20 -03:00
|
|
|
'auto_max_new_tokens',
|
2023-07-31 18:44:00 -07:00
|
|
|
},
|
|
|
|
'ExLlama': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'typical_p',
|
|
|
|
'repetition_penalty',
|
|
|
|
'repetition_penalty_range',
|
|
|
|
'seed',
|
2023-08-06 17:22:48 -03:00
|
|
|
'guidance_scale',
|
|
|
|
'negative_prompt',
|
2023-07-31 18:44:00 -07:00
|
|
|
'ban_eos_token',
|
2023-10-06 00:12:22 +02:00
|
|
|
'add_bos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-08-02 11:01:29 -07:00
|
|
|
'auto_max_new_tokens',
|
2023-07-31 18:44:00 -07:00
|
|
|
},
|
2023-09-12 14:33:07 -03:00
|
|
|
'ExLlamav2': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
2023-09-28 19:59:52 -07:00
|
|
|
'typical_p',
|
2023-09-12 14:33:07 -03:00
|
|
|
'repetition_penalty',
|
|
|
|
'repetition_penalty_range',
|
|
|
|
'seed',
|
|
|
|
'ban_eos_token',
|
2023-10-06 00:12:22 +02:00
|
|
|
'add_bos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-10-21 06:54:06 +02:00
|
|
|
'skip_special_tokens',
|
2023-09-12 14:33:07 -03:00
|
|
|
'auto_max_new_tokens',
|
|
|
|
},
|
|
|
|
'ExLlamav2_HF': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'typical_p',
|
|
|
|
'epsilon_cutoff',
|
|
|
|
'eta_cutoff',
|
|
|
|
'tfs',
|
|
|
|
'top_a',
|
|
|
|
'repetition_penalty',
|
|
|
|
'repetition_penalty_range',
|
|
|
|
'encoder_repetition_penalty',
|
|
|
|
'no_repeat_ngram_size',
|
|
|
|
'min_length',
|
|
|
|
'seed',
|
|
|
|
'do_sample',
|
|
|
|
'mirostat_mode',
|
|
|
|
'mirostat_tau',
|
|
|
|
'mirostat_eta',
|
2023-10-05 10:01:36 -03:00
|
|
|
'grammar_file_row',
|
|
|
|
'grammar_string',
|
2023-09-12 14:33:07 -03:00
|
|
|
'guidance_scale',
|
|
|
|
'negative_prompt',
|
|
|
|
'ban_eos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-09-12 14:33:07 -03:00
|
|
|
'add_bos_token',
|
|
|
|
'skip_special_tokens',
|
|
|
|
'auto_max_new_tokens',
|
|
|
|
},
|
2023-07-31 18:44:00 -07:00
|
|
|
'AutoGPTQ': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'typical_p',
|
|
|
|
'epsilon_cutoff',
|
|
|
|
'eta_cutoff',
|
|
|
|
'tfs',
|
|
|
|
'top_a',
|
|
|
|
'repetition_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',
|
2023-10-05 10:01:36 -03:00
|
|
|
'grammar_file_row',
|
|
|
|
'grammar_string',
|
2023-08-06 17:22:48 -03:00
|
|
|
'guidance_scale',
|
|
|
|
'negative_prompt',
|
2023-07-31 18:44:00 -07:00
|
|
|
'ban_eos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-07-31 18:44:00 -07:00
|
|
|
'add_bos_token',
|
|
|
|
'skip_special_tokens',
|
2023-08-02 14:52:20 -03:00
|
|
|
'auto_max_new_tokens',
|
2023-07-31 18:44:00 -07:00
|
|
|
},
|
|
|
|
'GPTQ-for-LLaMa': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'typical_p',
|
|
|
|
'epsilon_cutoff',
|
|
|
|
'eta_cutoff',
|
|
|
|
'tfs',
|
|
|
|
'top_a',
|
|
|
|
'repetition_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',
|
2023-10-05 10:01:36 -03:00
|
|
|
'grammar_file_row',
|
|
|
|
'grammar_string',
|
2023-08-06 17:22:48 -03:00
|
|
|
'guidance_scale',
|
|
|
|
'negative_prompt',
|
2023-07-31 18:44:00 -07:00
|
|
|
'ban_eos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-07-31 18:44:00 -07:00
|
|
|
'add_bos_token',
|
|
|
|
'skip_special_tokens',
|
2023-08-02 14:52:20 -03:00
|
|
|
'auto_max_new_tokens',
|
2023-07-31 18:44:00 -07:00
|
|
|
},
|
|
|
|
'llama.cpp': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'tfs',
|
|
|
|
'repetition_penalty',
|
|
|
|
'mirostat_mode',
|
|
|
|
'mirostat_tau',
|
|
|
|
'mirostat_eta',
|
2023-09-24 07:17:33 -07:00
|
|
|
'grammar_file_row',
|
2023-09-24 18:05:24 -03:00
|
|
|
'grammar_string',
|
2023-07-31 18:44:00 -07:00
|
|
|
'ban_eos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-07-31 18:44:00 -07:00
|
|
|
},
|
|
|
|
'llamacpp_HF': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'typical_p',
|
|
|
|
'epsilon_cutoff',
|
|
|
|
'eta_cutoff',
|
|
|
|
'tfs',
|
|
|
|
'top_a',
|
|
|
|
'repetition_penalty',
|
|
|
|
'repetition_penalty_range',
|
|
|
|
'encoder_repetition_penalty',
|
|
|
|
'no_repeat_ngram_size',
|
|
|
|
'min_length',
|
|
|
|
'seed',
|
|
|
|
'do_sample',
|
|
|
|
'mirostat_mode',
|
|
|
|
'mirostat_tau',
|
|
|
|
'mirostat_eta',
|
2023-10-05 10:01:36 -03:00
|
|
|
'grammar_file_row',
|
|
|
|
'grammar_string',
|
2023-08-24 20:32:21 -03:00
|
|
|
'guidance_scale',
|
|
|
|
'negative_prompt',
|
2023-07-31 18:44:00 -07:00
|
|
|
'ban_eos_token',
|
2023-09-15 14:27:27 -07:00
|
|
|
'custom_token_bans',
|
2023-07-31 18:44:00 -07:00
|
|
|
'add_bos_token',
|
|
|
|
'skip_special_tokens',
|
2023-08-02 14:52:20 -03:00
|
|
|
'auto_max_new_tokens',
|
2023-07-31 18:44:00 -07:00
|
|
|
},
|
2023-08-11 17:41:33 +00:00
|
|
|
'ctransformers': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'repetition_penalty',
|
2023-08-11 11:02:56 -07:00
|
|
|
'repetition_penalty_range',
|
2023-10-05 16:19:18 +00:00
|
|
|
},
|
|
|
|
'AutoAWQ': {
|
|
|
|
'temperature',
|
|
|
|
'top_p',
|
|
|
|
'top_k',
|
|
|
|
'typical_p',
|
|
|
|
'epsilon_cutoff',
|
|
|
|
'eta_cutoff',
|
|
|
|
'tfs',
|
|
|
|
'top_a',
|
|
|
|
'repetition_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',
|
|
|
|
},
|
2023-08-11 17:41:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
loaders_model_types = {
|
|
|
|
'GPTQ-for-LLaMa': [
|
|
|
|
"None",
|
|
|
|
"llama",
|
|
|
|
"opt",
|
|
|
|
"gptj"
|
|
|
|
],
|
|
|
|
'ctransformers': [
|
|
|
|
"None",
|
|
|
|
"gpt2",
|
|
|
|
"gptj",
|
|
|
|
"gptneox",
|
|
|
|
"llama",
|
|
|
|
"mpt",
|
2023-08-27 19:23:48 +05:30
|
|
|
"dollyv2",
|
2023-08-11 17:41:33 +00:00
|
|
|
"replit",
|
|
|
|
"starcoder",
|
2023-08-14 18:17:24 +00:00
|
|
|
"gptbigcode",
|
2023-08-11 17:41:33 +00:00
|
|
|
"falcon"
|
|
|
|
],
|
2023-07-31 18:44:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@functools.cache
|
|
|
|
def list_all_samplers():
|
|
|
|
all_samplers = set()
|
|
|
|
for k in loaders_samplers:
|
|
|
|
for sampler in loaders_samplers[k]:
|
|
|
|
all_samplers.add(sampler)
|
|
|
|
|
|
|
|
return sorted(all_samplers)
|
|
|
|
|
|
|
|
|
|
|
|
def blacklist_samplers(loader):
|
|
|
|
all_samplers = list_all_samplers()
|
|
|
|
if loader == 'All':
|
|
|
|
return [gr.update(visible=True) for sampler in all_samplers]
|
|
|
|
else:
|
|
|
|
return [gr.update(visible=True) if sampler in loaders_samplers[loader] else gr.update(visible=False) for sampler in all_samplers]
|
|
|
|
|
2023-06-16 19:00:37 -03:00
|
|
|
|
2023-08-11 17:41:33 +00:00
|
|
|
def get_model_types(loader):
|
|
|
|
if loader in loaders_model_types:
|
|
|
|
return loaders_model_types[loader]
|
|
|
|
|
|
|
|
return ["None"]
|
|
|
|
|
|
|
|
|
2023-06-16 19:00:37 -03:00
|
|
|
def get_gpu_memory_keys():
|
|
|
|
return [k for k in shared.gradio if k.startswith('gpu_memory')]
|
|
|
|
|
|
|
|
|
|
|
|
@functools.cache
|
|
|
|
def get_all_params():
|
|
|
|
all_params = set()
|
|
|
|
for k in loaders_and_params:
|
|
|
|
for el in loaders_and_params[k]:
|
|
|
|
all_params.add(el)
|
|
|
|
|
|
|
|
if 'gpu_memory' in all_params:
|
|
|
|
all_params.remove('gpu_memory')
|
|
|
|
for k in get_gpu_memory_keys():
|
|
|
|
all_params.add(k)
|
|
|
|
|
|
|
|
return sorted(all_params)
|
|
|
|
|
|
|
|
|
|
|
|
def make_loader_params_visible(loader):
|
|
|
|
params = []
|
|
|
|
all_params = get_all_params()
|
|
|
|
if loader in loaders_and_params:
|
|
|
|
params = loaders_and_params[loader]
|
|
|
|
|
|
|
|
if 'gpu_memory' in params:
|
|
|
|
params.remove('gpu_memory')
|
|
|
|
params += get_gpu_memory_keys()
|
|
|
|
|
|
|
|
return [gr.update(visible=True) if k in params else gr.update(visible=False) for k in all_params]
|