Sean-Case commited on
Commit
8249fd3
1 Parent(s): 994ad90

Made GPU layer bar invisible. Changed default GPU layers when CUDA available

Browse files
Files changed (2) hide show
  1. app.py +6 -4
  2. chatfuncs/chatfuncs.py +1 -1
app.py CHANGED
@@ -80,9 +80,11 @@ def load_model(model_type, gpu_layers, gpu_config=None, cpu_config=None, torch_d
80
  torch_device = chatf.torch_device
81
 
82
  if model_type == "Mistral Open Orca (larger, slow)":
83
-
84
- gpu_config.update_gpu(gpu_layers)
85
- cpu_config.update_gpu(gpu_layers)
 
 
86
 
87
  print("Loading with", cpu_config.gpu_layers, "model layers sent to GPU.")
88
 
@@ -231,7 +233,7 @@ with block:
231
  with gr.Tab("Advanced features"):
232
  model_choice = gr.Radio(label="Choose a chat model", value="Flan Alpaca (small, fast)", choices = ["Flan Alpaca (small, fast)", "Mistral Open Orca (larger, slow)"])
233
  with gr.Row():
234
- gpu_layer_choice = gr.Slider(label="Choose number of model layers to send to GPU (WARNING: please don't modify unless you have a GPU).", value=0, minimum=0, maximum=5, step = 1, visible=True)
235
  change_model_button = gr.Button(value="Load model", scale=0)
236
  load_text = gr.Text(label="Load status")
237
 
 
80
  torch_device = chatf.torch_device
81
 
82
  if model_type == "Mistral Open Orca (larger, slow)":
83
+ if torch_device == "cuda":
84
+ gpu_config.update_gpu(12)
85
+ else:
86
+ gpu_config.update_gpu(gpu_layers)
87
+ cpu_config.update_gpu(gpu_layers)
88
 
89
  print("Loading with", cpu_config.gpu_layers, "model layers sent to GPU.")
90
 
 
233
  with gr.Tab("Advanced features"):
234
  model_choice = gr.Radio(label="Choose a chat model", value="Flan Alpaca (small, fast)", choices = ["Flan Alpaca (small, fast)", "Mistral Open Orca (larger, slow)"])
235
  with gr.Row():
236
+ gpu_layer_choice = gr.Slider(label="Choose number of model layers to send to GPU (WARNING: please don't modify unless you have a GPU).", value=0, minimum=0, maximum=5, step = 1, visible=False)
237
  change_model_button = gr.Button(value="Load model", scale=0)
238
  load_text = gr.Text(label="Load status")
239
 
chatfuncs/chatfuncs.py CHANGED
@@ -69,7 +69,7 @@ kw_model = pipeline("feature-extraction", model="sentence-transformers/all-MiniL
69
 
70
  if torch.cuda.is_available():
71
  torch_device = "cuda"
72
- gpu_layers = 0
73
  else:
74
  torch_device = "cpu"
75
  gpu_layers = 0
 
69
 
70
  if torch.cuda.is_available():
71
  torch_device = "cuda"
72
+ gpu_layers = 12
73
  else:
74
  torch_device = "cpu"
75
  gpu_layers = 0