feat: expose the loaded model version name through the public API (#1962)

This commit is contained in:
fszontagh authored and GitHub committed 2026-09-11 23:39:56 +08:00
1 parent 3191b23d4b
commit e06b205384
3 files changed
+13

No files matched your search

+3
View File
@@ -99,6 +99,9 @@ const char* model_version_to_str[] = {
"ESRGAN",
};
static_assert(VERSION_COUNT == sizeof(model_version_to_str) / sizeof(model_version_to_str[0]),
"\nnumber of elements in model_version_to_str[] != VERSION_COUNT");
void calculate_alphas_cumprod(float* alphas_cumprod,
float linear_start = 0.00085f,
float linear_end = 0.0120f,
+7
View File
@@ -695,6 +695,13 @@ SD_API bool sd_ctx_has_control_net(const sd_ctx_t* sd_ctx) {
return sd_ctx->sd->control_net != nullptr;
}
const char* sd_get_model_version_name(const sd_ctx_t* sd_ctx) {
if (sd_ctx == nullptr || sd_ctx->sd == nullptr || sd_ctx->sd->version >= VERSION_COUNT) {
return "Unknown";
}
return model_version_to_str[sd_ctx->sd->version];
}
enum sample_method_t sd_get_default_sample_method(const sd_ctx_t* sd_ctx) {
return sd::pipeline::default_sample_method(sd_ctx != nullptr ? sd_ctx->sd : nullptr);
}