fix: include RPC devices in --list-devices (#2182)

This commit is contained in:
leejet authored and GitHub committed 2026-10-21 23:47:50 +08:00
1 parent 2e2ba3faec
commit b15c8aac39
7 files changed
+50 -20

No files matched your search

+16 -12
View File
@@ -596,6 +596,11 @@ ArgOptions SDContextParams::get_options() {
};
options.bool_options = {
{"",
"--list-devices",
"list available ggml backend devices, including --rpc-servers (one 'name<TAB>description' per line), and exit; "
"the names are the device names accepted by --backend and --params-backend",
true, &list_devices},
{"",
"--disable-prefetch",
"disable asynchronous next-segment weight prefetch (defaults to false)",
@@ -819,23 +824,22 @@ ArgOptions SDContextParams::get_options() {
"but it usually offers faster inference speed and, in some cases, lower memory usage. "
"The at_runtime mode, on the other hand, is exactly the opposite.",
on_lora_apply_mode_arg},
{"",
"--list-devices",
"list available ggml backend devices (one 'name<TAB>description' per line) and exit; "
"the names are the device names accepted by --backend and --params-backend",
[](int /*argc*/, const char** /*argv*/, int /*index*/) {
size_t device_list_size = sd_list_devices(nullptr, 0);
std::vector<char> devices(device_list_size + 1);
sd_list_devices(devices.data(), devices.size());
fputs(devices.data(), stdout);
std::exit(0);
return 0;
}},
};
return options;
}
bool SDContextParams::print_devices() const {
if (!sd_add_rpc_servers(rpc_servers.c_str())) {
return false;
}
size_t device_list_size = sd_list_devices(nullptr, 0);
std::vector<char> devices(device_list_size + 1);
sd_list_devices(devices.data(), devices.size());
fputs(devices.data(), stdout);
return true;
}
void SDContextParams::build_embedding_map() {
static const std::vector<std::string> valid_ext = {".gguf", ".safetensors", ".pt", ".ckpt"};