This commit is contained in:
leejet 2026-11-26 02:25:26 +08:00
parent 20368cdd64
commit 18d07d0e94
7 changed files with 30 additions and 30 deletions

View file

@ -696,7 +696,7 @@ namespace {
if (!readable && status.type() != fs::file_type::not_found)
return false;
const auto key = model_path_key(resolved);
const auto key = model_path_key(resolved);
const bool allowed = policy.configured_files.count(key) ||
std::any_of(policy.model_bundles.begin(), policy.model_bundles.end(), [&](const fs::path& root) {
return model_path_inside(root, resolved);
@ -840,7 +840,7 @@ void async_job_worker(ServerRuntime& runtime) {
json dgl_result_info;
std::string error_message;
const char* error_code = "generation_failed";
bool ok = false;
bool ok = false;
if (job->kind == AsyncJobKind::ImgGen) {
ok = execute_img_gen_job(runtime, *job, output_images, output_info, error_message);

View file

@ -179,7 +179,7 @@ void register_dgl_endpoints(httplib::Server& svr, ServerRuntime& runtime) {
job->id = make_async_job_id(manager);
manager.jobs.emplace(job->id, job);
manager.queue.push_back(job->id);
auto response = make_async_job_json(manager, *job);
auto response = make_async_job_json(manager, *job);
response["poll_url"] = "/sdcpp/v1/jobs/" + job->id;
send_json(res, 202, response);
}

View file

@ -8,10 +8,10 @@
#ifdef _WIN32
#include <winternl.h>
#else
#include <cerrno>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cerrno>
#endif
namespace media_view {
@ -44,13 +44,13 @@ namespace media_view {
GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "NtOpenFile"));
if (!open_file)
return FileHandle();
auto name = std::filesystem::u8path(part).native();
auto name = std::filesystem::u8path(part).native();
const auto bytes = static_cast<USHORT>(name.size() * sizeof(wchar_t));
UNICODE_STRING relative{bytes, bytes, name.data()};
OBJECT_ATTRIBUTES object;
InitializeObjectAttributes(&object, &relative, OBJ_CASE_INSENSITIVE, parent.get(), nullptr);
IO_STATUS_BLOCK status{};
HANDLE handle = INVALID_HANDLE_VALUE;
HANDLE handle = INVALID_HANDLE_VALUE;
const auto access = (directory ? FILE_TRAVERSE : FILE_READ_DATA) | FILE_READ_ATTRIBUTES | SYNCHRONIZE;
// A handle-relative open keeps every component under the directory already checked.
if (open_file(&handle, access, &object, &status, FILE_SHARE_READ | FILE_SHARE_WRITE,
@ -74,7 +74,7 @@ namespace media_view {
static size_t read_at(const FileHandle& file, size_t offset, char* buffer, size_t length) {
LARGE_INTEGER position{};
position.QuadPart = static_cast<LONGLONG>(offset);
DWORD count = 0;
DWORD count = 0;
if (!SetFilePointerEx(file.get(), position, nullptr, FILE_BEGIN) ||
!ReadFile(file.get(), buffer, static_cast<DWORD>(length), &count, nullptr))
return 0;
@ -109,7 +109,7 @@ namespace media_view {
}
static uint64_t file_size(const FileHandle& file) {
struct stat info {};
struct stat info{};
if (fstat(file.get(), &info) != 0 || !S_ISREG(info.st_mode) || info.st_nlink != 1 || info.st_size <= 0)
return 0;
return static_cast<uint64_t>(info.st_size);
@ -139,11 +139,11 @@ namespace media_view {
auto parent = open_child(cwd, root, true);
while (parent) {
const auto slash = path.find('/');
const auto part = path.substr(0, slash);
const auto part = path.substr(0, slash);
if (!valid_component(part))
break;
const bool directory = slash != std::string_view::npos;
auto child = open_child(parent, std::string(part), directory);
auto child = open_child(parent, std::string(part), directory);
if (!directory)
return child;
parent = std::move(child);
@ -238,7 +238,7 @@ namespace media_view {
if (size == 0 || size > std::numeric_limits<size_t>::max())
return false;
std::array<char, 256> header;
const auto count = read_at(file, 0, header.data(), header.size());
const auto count = read_at(file, 0, header.data(), header.size());
const auto extension = path.find_last_of('.');
if (extension == std::string::npos)
return false;

View file

@ -341,7 +341,7 @@ static json make_capabilities_json(ServerRuntime& runtime) {
};
result["generation_features"] = generation_features;
result["generation_model_selection"] = true;
result["media_view"] = runtime.svr_params->media_view;
result["media_view"] = runtime.svr_params->media_view;
result["runtime"] = model_status(runtime);
result["current_mode"] = current_mode;
result["supported_modes"] = supported_modes;

View file

@ -978,10 +978,10 @@ namespace sd {
const auto budget_bytes = available.available_budget_bytes == SIZE_MAX
? std::string("unlimited")
: sd_format("%.2f MB", available.available_budget_bytes / (1024.0 * 1024.0));
auto message = sd_format("execution engine cannot make enough memory available on %s: need %.2f MB device / %.2f MB budget, available %s device / %s budget",
ggml_backend_name(request.compute_backend),
available.required_device_bytes / (1024.0 * 1024.0),
available.required_budget_bytes / (1024.0 * 1024.0), device_bytes.c_str(), budget_bytes.c_str());
auto message = sd_format("execution engine cannot make enough memory available on %s: need %.2f MB device / %.2f MB budget, available %s device / %s budget",
ggml_backend_name(request.compute_backend),
available.required_device_bytes / (1024.0 * 1024.0),
available.required_budget_bytes / (1024.0 * 1024.0), device_bytes.c_str(), budget_bytes.c_str());
LOG_WARN("%s", message.c_str());
if (device_memory_error != nullptr && available.valid) {
*device_memory_error = std::move(message);

View file

@ -202,8 +202,8 @@ namespace sd::dgl::models {
return decoded;
}
if (!sd::backend_fit::prepare_vae_decode_retry_tiling(tiling_params, prefer_temporal_tiling,
first_stage_model->last_compute_status(),
tile_size_w, tile_size_h, first_stage_model->get_scale_factor())) {
first_stage_model->last_compute_status(),
tile_size_w, tile_size_h, first_stage_model->get_scale_factor())) {
break;
}
}

View file

@ -87,19 +87,19 @@ namespace RelayVSR {
}
ggml_tensor* forward(GGMLRunnerContext* ctx, ggml_tensor* x, ggml_tensor* context, ggml_tensor* query_rope, ggml_tensor* key_rope, const VSR::LocalAttention* local, const std::string& cut_group, const std::string& attention_name) {
auto to_q = std::dynamic_pointer_cast<Linear>(blocks["to_q"]);
auto to_k = std::dynamic_pointer_cast<Linear>(blocks["to_k"]);
auto to_v = std::dynamic_pointer_cast<Linear>(blocks["to_v"]);
auto to_out_0 = std::dynamic_pointer_cast<Linear>(blocks["to_out.0"]);
auto norm_q = std::dynamic_pointer_cast<RMSNorm>(blocks["norm_q"]);
auto norm_k = std::dynamic_pointer_cast<RMSNorm>(blocks["norm_k"]);
auto c = ctx->ggml_ctx;
auto q = norm_q->forward(ctx, to_q->forward(ctx, x));
auto to_q = std::dynamic_pointer_cast<Linear>(blocks["to_q"]);
auto to_k = std::dynamic_pointer_cast<Linear>(blocks["to_k"]);
auto to_v = std::dynamic_pointer_cast<Linear>(blocks["to_v"]);
auto to_out_0 = std::dynamic_pointer_cast<Linear>(blocks["to_out.0"]);
auto norm_q = std::dynamic_pointer_cast<RMSNorm>(blocks["norm_q"]);
auto norm_k = std::dynamic_pointer_cast<RMSNorm>(blocks["norm_k"]);
auto c = ctx->ggml_ctx;
auto q = norm_q->forward(ctx, to_q->forward(ctx, x));
const auto cache_name = cut_group + "." + attention_name;
auto past_k = ctx->get_cache_tensor(cache_name + ".key");
auto past_v = ctx->get_cache_tensor(cache_name + ".value");
ggml_tensor* k = nullptr;
ggml_tensor* v = nullptr;
auto past_k = ctx->get_cache_tensor(cache_name + ".key");
auto past_v = ctx->get_cache_tensor(cache_name + ".value");
ggml_tensor* k = nullptr;
ggml_tensor* v = nullptr;
if (context && past_k) {
k = past_k;
v = past_v;