From 068ea3da9027afc105de44e00cf95f80c9dcdd5e Mon Sep 17 00:00:00 2001 From: fuheaven Date: Mon, 6 Jul 2026 11:55:38 +0000 Subject: [PATCH 1/2] feat(x2i): raise image generation resolution cap to 4K New neo model is trained at 4K, so lift the resolution ceiling from 2K: - add 4K presets to ImageConfig aspect-ratio table and allowed size set - bump smart_resize max_pixels from 2048^2 to 4096^2 in ImageConfig.get_resolution (t2i / custom height-width) and X2IParams.update_hw (it2i output = input size) Verified end-to-end: custom 4096x4096 and 4K 16:9 (4096x2304) t2i generation. --- lightllm/server/api_models.py | 26 ++++++++++++------------- lightllm/server/core/objs/x2i_params.py | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lightllm/server/api_models.py b/lightllm/server/api_models.py index eb10c5b384..b2cd53a4c1 100644 --- a/lightllm/server/api_models.py +++ b/lightllm/server/api_models.py @@ -447,19 +447,19 @@ class ImageConfig(BaseModel): cfg_norm: Optional[Literal["none", "cfg_zero_star", "global", "text_channel", "channel"]] = None dynamic_resolution: Optional[bool] = True _aspect_ratio_to_resolution: ClassVar[dict] = { - "1:1": {"1K": (1024, 1024), "1.5K": (1536, 1536), "2K": (2048, 2048)}, - "16:9": {"1.5K": (2048, 1152), "2K": (2720, 1536)}, - "9:16": {"1.5K": (1152, 2048), "2K": (1536, 2720)}, - "3:2": {"1.5K": (1888, 1248), "2K": (2496, 1664)}, - "2:3": {"1.5K": (1248, 1888), "2K": (1664, 2496)}, - "4:3": {"1.5K": (1760, 1312), "2K": (2368, 1760)}, - "3:4": {"1.5K": (1312, 1760), "2K": (1760, 2368)}, - "1:2": {"1.5K": (1088, 2144), "2K": (1440, 2880)}, - "2:1": {"1.5K": (2144, 1088), "2K": (2880, 1440)}, - "1:3": {"1.5K": (864, 2592), "2K": (1152, 3456)}, - "3:1": {"1.5K": (2592, 864), "2K": (3456, 1152)}, + "1:1": {"1K": (1024, 1024), "1.5K": (1536, 1536), "2K": (2048, 2048), "4K": (4096, 4096)}, + "16:9": {"1.5K": (2048, 1152), "2K": (2720, 1536), "4K": (4096, 2304)}, + "9:16": {"1.5K": (1152, 2048), "2K": (1536, 2720), "4K": (2304, 4096)}, + "3:2": {"1.5K": (1888, 1248), "2K": (2496, 1664), "4K": (4096, 2720)}, + "2:3": {"1.5K": (1248, 1888), "2K": (1664, 2496), "4K": (2720, 4096)}, + "4:3": {"1.5K": (1760, 1312), "2K": (2368, 1760), "4K": (4096, 3072)}, + "3:4": {"1.5K": (1312, 1760), "2K": (1760, 2368), "4K": (3072, 4096)}, + "1:2": {"1.5K": (1088, 2144), "2K": (1440, 2880), "4K": (2048, 4096)}, + "2:1": {"1.5K": (2144, 1088), "2K": (2880, 1440), "4K": (4096, 2048)}, + "1:3": {"1.5K": (864, 2592), "2K": (1152, 3456), "4K": (1376, 4096)}, + "3:1": {"1.5K": (2592, 864), "2K": (3456, 1152), "4K": (4096, 1376)}, } - _size_set: ClassVar[set[str]] = {"1.5K", "2K"} + _size_set: ClassVar[set[str]] = {"1.5K", "2K", "4K"} @field_validator("image_size", mode="before") @classmethod @@ -508,7 +508,7 @@ def get_resolution(self): base = self._aspect_ratio_to_resolution[self.aspect_ratio][self.image_size] w, h = base - h, w = smart_resize(h, w, factor=32, min_pixels=1024 * 1024, max_pixels=2048 * 2048) + h, w = smart_resize(h, w, factor=32, min_pixels=1024 * 1024, max_pixels=4096 * 4096) return w, h diff --git a/lightllm/server/core/objs/x2i_params.py b/lightllm/server/core/objs/x2i_params.py index d629f0a915..a91c48f44e 100644 --- a/lightllm/server/core/objs/x2i_params.py +++ b/lightllm/server/core/objs/x2i_params.py @@ -123,7 +123,7 @@ def update_hw(self, width: int, height: int): return from lightllm.models.neo_chat_moe.vision_process import smart_resize - h, w = smart_resize(height, width, factor=32, min_pixels=512 * 512, max_pixels=2048 * 2048) + h, w = smart_resize(height, width, factor=32, min_pixels=512 * 512, max_pixels=4096 * 4096) self.width = w self.height = h self.has_updated_hw = True From cafd5825ac82fc5949a3fd1cc2756b1e27a4b3b4 Mon Sep 17 00:00:00 2001 From: fuheaven Date: Thu, 9 Jul 2026 17:40:24 +0800 Subject: [PATCH 2/2] fix(server): flatten OpenAI multimodal content before chat template OpenAI-style it2i/vqa requests send message.content as a list of parts (image_url/text). Qwen-style HF chat templates call string methods like startswith on content, which raises UndefinedError and 500s the request. Flatten list content to a string with /