Skip to content

QVAC-18475 feat[api]: add ESRGAN upscale support to SDK diffusion#1930

Merged
maxim-smotrov merged 10 commits into
tetherto:mainfrom
maxim-smotrov:feature/diffusion-upscaler-support
May 11, 2026
Merged

QVAC-18475 feat[api]: add ESRGAN upscale support to SDK diffusion#1930
maxim-smotrov merged 10 commits into
tetherto:mainfrom
maxim-smotrov:feature/diffusion-upscaler-support

Conversation

@maxim-smotrov
Copy link
Copy Markdown
Contributor

@maxim-smotrov maxim-smotrov commented May 6, 2026

🎯 What problem does this PR solve?

  • Users could generate low-resolution diffusion images, but had no SDK-level way to produce higher-resolution outputs with the ESRGAN upscaler supported by the native diffusion backend.

📝 How does it solve it?

  • Adds an upscaler config object (with model_src and ESRGAN tuning fields) to diffusion model config.
  • Adds upscale: true | { repeats?: number } to diffusion requests and forwards it to @qvac/diffusion-cpp.
  • Bumps @qvac/diffusion-cpp to ^0.6.0 and adds an ESRGAN upscale example.

🧪 How was it tested?

  • Added/updated unit coverage for ESRGAN config validation, upscale request validation, plugin request forwarding, and diffusion op normalization.
  • Ran bun run test:unit in packages/sdk.

🔌 API Changes

  • loadModel({ modelType: "diffusion", modelConfig }) now accepts an upscaler object to load ESRGAN upscaler weights alongside the diffusion model. upscaler.model_src is required when upscaler is set.
  • The upscaler object accepts optional ESRGAN tuning fields: type (currently only "esrgan"), tile_size, direct, offload_params_to_cpu, and threads.
  • diffusion() now accepts upscale: true for one ESRGAN pass, or upscale: { repeats: N } for repeated upscale passes. upscale: false is treated the same as omitting the option.
const modelId = await loadModel({
  modelSrc: SD_V2_1_1B_Q8_0,
  modelType: "diffusion",
  modelConfig: {
    prediction: "v",
    upscaler: {
      type: "esrgan",
      model_src: "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
      tile_size: 128,
      direct: false,
      offload_params_to_cpu: false,
      threads: -1,
    },
  },
});

const { outputs } = diffusion({
  modelId,
  prompt: "an illustrated red fox portrait",
  width: 128,
  height: 128,
  upscale: { repeats: 2 },
});

simon-iribarren
simon-iribarren previously approved these changes May 6, 2026
Comment thread packages/sdk/tests-qvac/tests/desktop/consumer.ts Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

QVAC E2E — windows⚠️ no results

Config: suite=smoke · filter=(none) · exclude=(none)
View run

The test job did not produce a results artifact. Check the run for job-level failures.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

QVAC E2E — linux — ✅ all tests passed (91/91, 589s)

Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

QVAC E2E — macos — ✅ all tests passed (91/91, 401s)

Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

QVAC E2E — android — ❌ failed

Totals: 81/91 passed · 4 failed · 95.3% · 2300s
Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports · Device Farm logs

Results by section

  • model: 6/8 ❌
  • multi-gpu: 0/2 ❌

Failed tests

  • model-load-inferred-type: Consumer died before test could be executed
  • model-load-missing-type-string-src: Consumer died before test could be executed
  • multi-gpu-config-smoke: Consumer became unresponsive (no heartbeat for 129s)
  • multi-gpu-embed-config-smoke: Consumer died before test could be executed

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

QVAC E2E — ios — ✅ all tests passed (78/91, 916s)

Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports · Device Farm logs

@maxim-smotrov
Copy link
Copy Markdown
Contributor Author

/review

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

Tier-based Approval Status

**PR Tier:** TIER1

**Current Status:** ✅ APPROVED

**Requirements:**
- 1 Team Member approval ✅ (3/1)
- 1 Team Lead OR Management approval ✅ (2/1)

**Bypass rule:** Triggered (2+ Team Lead approvals (Tier 1 exception)). This PR is approved regardless of tier.

---
*This comment is automatically updated when reviews change.*

@maxim-smotrov
Copy link
Copy Markdown
Contributor Author

/review

@maxim-smotrov
Copy link
Copy Markdown
Contributor Author

/review

@maxim-smotrov
Copy link
Copy Markdown
Contributor Author

/verify

@maxim-smotrov maxim-smotrov merged commit adcfe72 into tetherto:main May 11, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-e2e-smoke Triggers smoke e2e test suite [Currently SDK-only]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants