Skip to content

Commit b15187a

Browse files
committed
Update configuration paths and enhance parameter options in the model configuration
- Changed configuration file paths from "configs" to "config" in CUDA and LMDeploy installers. - Added new parameters with options for tensor split and main GPU in the parameter registry. - Enhanced the ModelConfig view to support dropdowns for parameters with options, improving user experience. - Updated styles for dropdown components to align with the new design specifications.
1 parent e5fff0a commit b15187a

6 files changed

Lines changed: 172 additions & 58 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ RUN ln -sf /usr/bin/python3 /usr/bin/python
167167

168168
# Create non-root user and data directory structure
169169
RUN useradd -m -s /bin/bash appuser && \
170-
mkdir -p /app/data/models /app/data/config /app/data/configs /app/data/logs /app/data/llama-cpp /app/data/hf-cache/hub && \
170+
mkdir -p /app/data/models /app/data/config /app/data/logs /app/data/llama-cpp /app/data/hf-cache/hub && \
171171
chown -R appuser:appuser /app && \
172172
# Ensure entrypoint script is accessible to appuser
173173
chmod 755 /usr/local/bin/docker-entrypoint.sh

backend/cuda_installer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(
100100

101101
log_path = log_path or os.path.join(data_root, "logs", "cuda_install.log")
102102
state_path = state_path or os.path.join(
103-
data_root, "configs", "cuda_installer.json"
103+
data_root, "config", "cuda_installer.json"
104104
)
105105
download_dir = download_dir or os.path.join(
106106
data_root, "temp", "cuda_installers"

backend/lmdeploy_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(
6363
self._venv_path = os.path.join(self._base_dir, "venv")
6464
log_path = log_path or os.path.join(data_root, "logs", "lmdeploy_install.log")
6565
state_path = state_path or os.path.join(
66-
data_root, "configs", "lmdeploy_manager.json"
66+
data_root, "config", "lmdeploy_manager.json"
6767
)
6868
self._log_path = os.path.abspath(log_path)
6969
self._state_path = os.path.abspath(state_path)

backend/param_registry.py

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import copy
77
from typing import Any, Dict, List
88

9-
# Param entry: key, label, type ("int"|"float"|"bool"|"string"), default, min, max (optional), description (optional)
9+
# Param entry: key, label, type ("int"|"float"|"bool"|"string"), default, min, max (optional), description (optional), options (optional)
10+
# options: list of {"value": ..., "label": "..."} for select/dropdown; when present, frontend renders a select instead of text/number input
1011
ParamDef = Dict[str, Any]
1112

1213
# Basic params shown by default (most common for chat/embedding)
@@ -15,51 +16,51 @@
1516
{"key": "model_alias", "label": "Model alias", "type": "string", "default": "", "description": "Expose this model under a custom runtime ID instead of the default Hugging Face-derived name"},
1617
{"key": "ctx_size", "label": "Context size", "type": "int", "default": 2048, "min": 512, "max": 1_000_000, "description": "Maximum context length in tokens"},
1718
{"key": "n_gpu_layers", "label": "GPU layers", "type": "int", "default": -1, "min": -1, "max": 1000, "description": "Number of layers to offload to GPU (-1 = all)"},
19+
{"key": "tensor_split", "label": "Tensor split", "type": "string", "default": "", "description": "Comma-separated GPU allocation (e.g. 40,30,30)"},
20+
{"key": "main_gpu", "label": "Main GPU", "type": "int", "default": 0, "min": 0, "description": "Index of the main GPU"},
1821
{"key": "batch_size", "label": "Batch size", "type": "int", "default": 512, "min": 1, "max": 2048, "description": "Batch size for prompt processing"},
1922
{"key": "threads", "label": "Threads", "type": "int", "default": 4, "min": 1, "max": 64, "description": "Number of threads"},
2023
{"key": "embedding", "label": "Embedding mode", "type": "bool", "default": False, "description": "Enable embedding-only mode"},
2124
]
2225

2326
# Advanced params (shown in expandable "Advanced" section)
2427
LLAMA_CPP_ADVANCED: List[ParamDef] = [
25-
{"key": "n_predict", "label": "Max tokens to predict", "type": "int", "default": -1, "min": -1, "max": 100_000},
26-
{"key": "ubatch_size", "label": "Ubatch size", "type": "int", "default": 512, "min": 1, "max": 2048},
27-
{"key": "temp", "label": "Temperature", "type": "float", "default": 0.8, "min": 0, "max": 2},
28-
{"key": "top_k", "label": "Top K", "type": "int", "default": 40, "min": 0, "max": 1000},
29-
{"key": "top_p", "label": "Top P", "type": "float", "default": 0.9, "min": 0, "max": 1},
30-
{"key": "min_p", "label": "Min P", "type": "float", "default": 0.0, "min": 0, "max": 1},
31-
{"key": "typical_p", "label": "Typical P", "type": "float", "default": 1.0, "min": 0, "max": 1},
32-
{"key": "repeat_penalty", "label": "Repeat penalty", "type": "float", "default": 1.1, "min": 1, "max": 2},
33-
{"key": "presence_penalty", "label": "Presence penalty", "type": "float", "default": 0, "min": -2, "max": 2},
34-
{"key": "frequency_penalty", "label": "Frequency penalty", "type": "float", "default": 0, "min": -2, "max": 2},
35-
{"key": "seed", "label": "Seed", "type": "int", "default": -1, "min": -1, "max": 2**31 - 1},
36-
{"key": "threads_batch", "label": "Threads (batch)", "type": "int", "default": -1, "min": -1, "max": 64},
37-
{"key": "parallel", "label": "Parallel", "type": "int", "default": 1, "min": 1, "max": 64},
38-
{"key": "rope_freq_base", "label": "RoPE freq base", "type": "float", "default": 0, "min": 0},
39-
{"key": "rope_freq_scale", "label": "RoPE freq scale", "type": "float", "default": 0, "min": 0},
40-
{"key": "flash_attn", "label": "Flash attention", "type": "bool", "default": False},
41-
{"key": "yarn_ext_factor", "label": "YaRN ext factor", "type": "float", "default": -1, "min": -1},
42-
{"key": "yarn_attn_factor", "label": "YaRN attn factor", "type": "float", "default": 1, "min": 0},
43-
{"key": "no_mmap", "label": "No mmap", "type": "bool", "default": False},
44-
{"key": "mlock", "label": "MLock", "type": "bool", "default": False},
45-
{"key": "low_vram", "label": "Low VRAM", "type": "bool", "default": False},
46-
{"key": "logits_all", "label": "Logits all", "type": "bool", "default": False},
47-
{"key": "cont_batching", "label": "Continuous batching", "type": "bool", "default": True},
48-
{"key": "no_kv_offload", "label": "No KV offload", "type": "bool", "default": False},
49-
{"key": "tensor_split", "label": "Tensor split", "type": "string", "default": ""},
50-
{"key": "main_gpu", "label": "Main GPU", "type": "int", "default": 0, "min": 0},
51-
{"key": "split_mode", "label": "Split mode", "type": "string", "default": ""},
52-
{"key": "cache_type_k", "label": "Cache type K", "type": "string", "default": ""},
53-
{"key": "cache_type_v", "label": "Cache type V", "type": "string", "default": ""},
54-
{"key": "grammar", "label": "Grammar", "type": "string", "default": ""},
55-
{"key": "json_schema", "label": "JSON schema", "type": "string", "default": ""},
56-
{"key": "cpu_moe", "label": "CPU MoE", "type": "bool", "default": False},
57-
{"key": "n_cpu_moe", "label": "N CPU MoE", "type": "int", "default": 0, "min": 0},
58-
{"key": "override_tensor", "label": "Override tensor", "type": "string", "default": ""},
59-
{"key": "rope_scaling", "label": "RoPE scaling", "type": "string", "default": ""},
60-
{"key": "mirostat", "label": "Mirostat", "type": "int", "default": 0, "min": 0, "max": 2},
61-
{"key": "mirostat_tau", "label": "Mirostat tau", "type": "float", "default": 5.0, "min": 0},
62-
{"key": "mirostat_eta", "label": "Mirostat eta", "type": "float", "default": 0.1, "min": 0},
28+
{"key": "n_predict", "label": "Max tokens to predict", "type": "int", "default": -1, "min": -1, "max": 100_000, "description": "Maximum tokens to generate (-1 = no limit)"},
29+
{"key": "ubatch_size", "label": "Ubatch size", "type": "int", "default": 512, "min": 1, "max": 2048, "description": "Micro-batch size for prompt processing"},
30+
{"key": "temp", "label": "Temperature", "type": "float", "default": 0.8, "min": 0, "max": 2, "description": "Sampling temperature (higher = more random)"},
31+
{"key": "top_k", "label": "Top K", "type": "int", "default": 40, "min": 0, "max": 1000, "description": "Limit sampling to top K tokens (0 = disabled)"},
32+
{"key": "top_p", "label": "Top P", "type": "float", "default": 0.9, "min": 0, "max": 1, "description": "Nucleus sampling: keep smallest set with cumulative probability"},
33+
{"key": "min_p", "label": "Min P", "type": "float", "default": 0.0, "min": 0, "max": 1, "description": "Minimum token probability for sampling"},
34+
{"key": "typical_p", "label": "Typical P", "type": "float", "default": 1.0, "min": 0, "max": 1, "description": "Typical sampling (1 = disabled)"},
35+
{"key": "repeat_penalty", "label": "Repeat penalty", "type": "float", "default": 1.1, "min": 1, "max": 2, "description": "Penalize repeated tokens"},
36+
{"key": "presence_penalty", "label": "Presence penalty", "type": "float", "default": 0, "min": -2, "max": 2, "description": "Penalize tokens that have appeared"},
37+
{"key": "frequency_penalty", "label": "Frequency penalty", "type": "float", "default": 0, "min": -2, "max": 2, "description": "Penalize by token frequency"},
38+
{"key": "seed", "label": "Seed", "type": "int", "default": -1, "min": -1, "max": 2**31 - 1, "description": "Random seed for reproducibility (-1 = random)"},
39+
{"key": "threads_batch", "label": "Threads (batch)", "type": "int", "default": -1, "min": -1, "max": 64, "description": "Threads for batch inference (-1 = use threads)"},
40+
{"key": "parallel", "label": "Parallel", "type": "int", "default": 1, "min": 1, "max": 64, "description": "Number of parallel sequences"},
41+
{"key": "rope_freq_base", "label": "RoPE freq base", "type": "float", "default": 0, "min": 0, "description": "RoPE base frequency (0 = from model)"},
42+
{"key": "rope_freq_scale", "label": "RoPE freq scale", "type": "float", "default": 0, "min": 0, "description": "RoPE frequency scaling (0 = from model)"},
43+
{"key": "flash_attn", "label": "Flash attention", "type": "bool", "default": False, "description": "Use Flash Attention when available"},
44+
{"key": "yarn_ext_factor", "label": "YaRN ext factor", "type": "float", "default": -1, "min": -1, "description": "YaRN extension factor (-1 = disabled)"},
45+
{"key": "yarn_attn_factor", "label": "YaRN attn factor", "type": "float", "default": 1, "min": 0, "description": "YaRN attention factor"},
46+
{"key": "no_mmap", "label": "No mmap", "type": "bool", "default": False, "description": "Disable memory-mapped model loading"},
47+
{"key": "mlock", "label": "MLock", "type": "bool", "default": False, "description": "Lock model in RAM to prevent swapping"},
48+
{"key": "low_vram", "label": "Low VRAM", "type": "bool", "default": False, "description": "Reduce VRAM use (slower inference)"},
49+
{"key": "logits_all", "label": "Logits all", "type": "bool", "default": False, "description": "Return logits for all tokens (embedding mode)"},
50+
{"key": "cont_batching", "label": "Continuous batching", "type": "bool", "default": True, "description": "Use continuous batching for higher throughput"},
51+
{"key": "no_kv_offload", "label": "No KV offload", "type": "bool", "default": False, "description": "Disable KV cache offload to CPU"},
52+
{"key": "split_mode", "label": "Split mode", "type": "string", "default": "", "description": "Tensor split mode (e.g. layer, row)", "options": [{"value": "", "label": "Default"}, {"value": "layer", "label": "Layer"}, {"value": "row", "label": "Row"}]},
53+
{"key": "cache_type_k", "label": "Cache type K", "type": "string", "default": "", "description": "K cache backend (e.g. f16, q8_0)", "options": [{"value": "", "label": "Default"}, {"value": "f16", "label": "f16"}, {"value": "q8_0", "label": "q8_0"}, {"value": "q4_0", "label": "q4_0"}, {"value": "q4_1", "label": "q4_1"}]},
54+
{"key": "cache_type_v", "label": "Cache type V", "type": "string", "default": "", "description": "V cache backend (e.g. f16, q8_0)", "options": [{"value": "", "label": "Default"}, {"value": "f16", "label": "f16"}, {"value": "q8_0", "label": "q8_0"}, {"value": "q4_0", "label": "q4_0"}, {"value": "q4_1", "label": "q4_1"}]},
55+
{"key": "grammar", "label": "Grammar", "type": "string", "default": "", "description": "BNF grammar for constrained output"},
56+
{"key": "json_schema", "label": "JSON schema", "type": "string", "default": "", "description": "JSON schema for structured output"},
57+
{"key": "cpu_moe", "label": "CPU MoE", "type": "bool", "default": False, "description": "Run MoE experts on CPU"},
58+
{"key": "n_cpu_moe", "label": "N CPU MoE", "type": "int", "default": 0, "min": 0, "description": "Number of MoE experts to run on CPU"},
59+
{"key": "override_tensor", "label": "Override tensor", "type": "string", "default": "", "description": "Override tensor layout (e.g. for debugging)"},
60+
{"key": "rope_scaling", "label": "RoPE scaling", "type": "string", "default": "", "description": "RoPE scaling type (e.g. yarn, linear)", "options": [{"value": "", "label": "Default"}, {"value": "yarn", "label": "YaRN"}, {"value": "linear", "label": "Linear"}, {"value": "none", "label": "None"}]},
61+
{"key": "mirostat", "label": "Mirostat", "type": "int", "default": 0, "min": 0, "max": 2, "description": "Mirostat mode (0=off, 1=mirostat, 2=mirostat 2.0)", "options": [{"value": 0, "label": "Off"}, {"value": 1, "label": "Mirostat 1"}, {"value": 2, "label": "Mirostat 2.0"}]},
62+
{"key": "mirostat_tau", "label": "Mirostat tau", "type": "float", "default": 5.0, "min": 0, "description": "Mirostat target perplexity"},
63+
{"key": "mirostat_eta", "label": "Mirostat eta", "type": "float", "default": 0.1, "min": 0, "description": "Mirostat learning rate"},
6364
]
6465

6566
# ik_llama.cpp: same as llama_cpp plus these extras (and different mirostat flag names)
@@ -78,8 +79,8 @@
7879
{"key": "tensor_parallel", "label": "Tensor parallel", "type": "int", "default": 1, "min": 1, "max": 8, "description": "Tensor parallelism degree"},
7980
]
8081
LMDEPLOY_ADVANCED: List[ParamDef] = [
81-
{"key": "dtype", "label": "Dtype", "type": "string", "default": "auto", "description": "Model dtype (auto, float16, bfloat16)"},
82-
{"key": "quant_policy", "label": "Quantization policy", "type": "int", "default": 0, "min": 0, "max": 8, "description": "KV cache quantization (0=off, 4=4bit, 8=8bit)"},
82+
{"key": "dtype", "label": "Dtype", "type": "string", "default": "auto", "description": "Model dtype (auto, float16, bfloat16)", "options": [{"value": "auto", "label": "Auto"}, {"value": "float16", "label": "float16"}, {"value": "bfloat16", "label": "bfloat16"}]},
83+
{"key": "quant_policy", "label": "Quantization policy", "type": "int", "default": 0, "min": 0, "max": 8, "description": "KV cache quantization (0=off, 4=4bit, 8=8bit)", "options": [{"value": 0, "label": "Off"}, {"value": 4, "label": "4-bit"}, {"value": 8, "label": "8-bit"}]},
8384
{"key": "enable_prefix_caching", "label": "Prefix caching", "type": "bool", "default": False, "description": "Enable prefix caching"},
8485
{"key": "chat_template", "label": "Chat template", "type": "string", "default": "", "description": "Override chat template"},
8586
]

frontend/src/styles/_components.css

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,16 +605,98 @@
605605
box-shadow: var(--shadow-lg);
606606
}
607607

608+
/* Dropdown header and filter: no white border, theme colors only */
609+
.p-dropdown-panel .p-dropdown-header {
610+
padding: 0.5rem 0.75rem;
611+
border: none;
612+
outline: none;
613+
box-shadow: none;
614+
background: transparent;
615+
color: var(--text-secondary);
616+
}
617+
.p-dropdown-panel .p-dropdown-header * {
618+
border-color: var(--border-primary);
619+
}
620+
.p-dropdown-panel .p-dropdown-filter-container {
621+
display: flex;
622+
align-items: center;
623+
height: 2.375rem;
624+
border: 1px solid var(--border-primary);
625+
border-radius: var(--radius-md);
626+
background: var(--bg-surface);
627+
color: var(--text-primary);
628+
box-sizing: border-box;
629+
position: relative;
630+
}
631+
/* Fallback search icon (visible when PrimeVue SVG is not) */
632+
.p-dropdown-panel .p-dropdown-filter-container::before {
633+
content: '';
634+
flex-shrink: 0;
635+
width: 1rem;
636+
height: 1rem;
637+
margin: 0 0.5rem;
638+
background-color: var(--text-secondary);
639+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
640+
mask-size: contain;
641+
mask-repeat: no-repeat;
642+
mask-position: center;
643+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
644+
-webkit-mask-size: contain;
645+
-webkit-mask-repeat: no-repeat;
646+
-webkit-mask-position: center;
647+
}
648+
.p-dropdown-panel .p-dropdown-filter-container:focus-within {
649+
outline: none;
650+
border-color: var(--accent-cyan);
651+
box-shadow: 0 0 0 3px var(--focus-ring);
652+
}
653+
/* Hide built-in filter icon; we use ::before on container as fallback */
654+
.p-dropdown-panel .p-dropdown-filter-container .p-dropdown-filter-icon,
655+
.p-dropdown-panel .p-dropdown-filter-container [data-pc-section="filtericon"] {
656+
display: none !important;
657+
}
658+
.p-dropdown-panel .p-dropdown-filter {
659+
flex: 1;
660+
min-width: 0;
661+
height: 100%;
662+
padding: 0 0.5rem;
663+
border: none;
664+
background: transparent;
665+
color: var(--text-primary);
666+
border-radius: 0;
667+
box-shadow: none;
668+
}
669+
.p-dropdown-panel .p-dropdown-filter::placeholder {
670+
color: var(--text-muted);
671+
}
672+
608673
.p-dropdown-panel .p-dropdown-items .p-dropdown-item {
609674
color: var(--text-primary);
610675
background: transparent;
676+
padding-left: 0.75rem;
677+
padding-right: 0.75rem;
611678
}
612679

613680
.p-dropdown-panel .p-dropdown-items .p-dropdown-item:hover {
614681
background: var(--hover-bg);
615682
}
616683

684+
/* InputNumber: fixed height and contain inner input (no overflow) */
685+
.p-inputnumber {
686+
height: 2.375rem;
687+
min-height: 2.375rem;
688+
padding: 0 0.25rem;
689+
display: flex;
690+
align-items: center;
691+
box-sizing: border-box;
692+
}
693+
617694
.p-inputnumber .p-inputnumber-input {
695+
height: 2rem;
696+
max-height: 100%;
697+
padding: 0 0.25rem;
698+
line-height: 2rem;
699+
box-sizing: border-box;
618700
background: transparent;
619701
color: var(--text-primary);
620702
border: none;

0 commit comments

Comments
 (0)