Skip to content

Commit 78f1bd9

Browse files
filipstrandCursor Assistant
andauthored
Add SeedVR2 7B upscale image test support. (#360)
Co-authored-by: Cursor Assistant <assistant@cursor.com>
1 parent 3e6f10b commit 78f1bd9

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

src/mflux/models/seedvr2/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,16 @@ Instead of specifying a target resolution, you can also use `--resolution 2x` or
4141

4242
You can also adjust the `--softness` parameter (0.0 to 1.0) to control input pre-downsampling, which can help achieve smoother upscaling results. A value of 0.0 (default) disables pre-downsampling, while higher values up to 1.0 increase the downsampling factor (up to 8x internally) before upscaling. A value of `0.5` is often a good starting point.
4343

44+
> [!NOTE]
45+
> Upscaling to very large resolutions can require a lot of memory. If you run into memory pressure, try `--low-ram` or set an MLX cache limit with `--mlx-cache-limit-gb 16` (replace `16` with a value that fits your machine).
46+
4447
## Upscale a Directory
4548

4649
Pass a directory to `--image-path` to upscale every image inside.
4750

51+
> [!WARNING]
52+
> `--low-ram` is not supported when upscaling a directory. That mode offloads the transformer after each image, which conflicts with the folder-processing flow.
53+
4854
```sh
4955
mflux-upscale-seedvr2 \
5056
--image-path "./inputs" \

tests/image_generation/helpers/seedvr2_upscale_test_helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def assert_matches_reference_image(
1414
output_image_path: str,
1515
input_image_path: str,
1616
*,
17+
model_config: ModelConfig | None = None,
1718
tiling_config: TilingConfig | None = None,
1819
seed: int = 42,
1920
resolution: int = 320,
@@ -28,7 +29,7 @@ def assert_matches_reference_image(
2829
model = SeedVR2(
2930
quantize=quantize,
3031
model_path=None,
31-
model_config=ModelConfig.seedvr2_3b(),
32+
model_config=model_config or ModelConfig.seedvr2_3b(),
3233
)
3334
if tiling_config is not None:
3435
model.tiling_config = tiling_config

tests/image_generation/test_generate_image_seedvr2_upscale.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22

3+
from mflux.models.common.config.model_config import ModelConfig
34
from tests.image_generation.helpers.seedvr2_upscale_test_helper import SeedVR2UpscaleTestHelper
45

56

@@ -14,3 +15,15 @@ def test_seedvr2_upscale(self):
1415
resolution=1080,
1516
quantize=8,
1617
)
18+
19+
@pytest.mark.slow
20+
def test_seedvr2_7b_upscale(self):
21+
SeedVR2UpscaleTestHelper.assert_matches_reference_image(
22+
reference_image_path="reference_seedvr2_7b_upscaled.png",
23+
output_image_path="output_seedvr2_7b_upscaled.png",
24+
input_image_path="reference_z_image_turbo_lora.png",
25+
model_config=ModelConfig.seedvr2_7b(),
26+
seed=42,
27+
resolution=1080,
28+
quantize=8,
29+
)
3.07 MB
Loading

0 commit comments

Comments
 (0)