[Quantization] feat: add FP8 for Omnigen2 (#2441)

Signed-off-by: Zhang <jianmusings@gmail.com>
This commit is contained in:
Zhang Jian authored and GitHub committed 2026-04-16 23:33:40 +08:00
1 parent c3ca5daafb
commit 817e32d548
2 files changed
+174 -10

No files matched your search

@@ -676,7 +676,10 @@ class OmniGen2Pipeline(CFGParallelMixin, nn.Module):
)
transformer_kwargs = get_transformer_config_kwargs(od_config.tf_model_config, OmniGen2Transformer2DModel)
self.transformer = OmniGen2Transformer2DModel(**transformer_kwargs)
self.transformer = OmniGen2Transformer2DModel(
**transformer_kwargs,
quant_config=od_config.quantization_config,
)
self.mllm = Qwen2_5_VLForConditionalGeneration.from_pretrained(
model, subfolder="mllm", local_files_only=local_files_only
).to(self.device)
@@ -1253,8 +1256,6 @@ class OmniGen2Pipeline(CFGParallelMixin, nn.Module):
# broadcast to batch dimension in a way that's compatible with ONNX/Core ML
timestep = t.expand(latents.shape[0]).to(latents.dtype)
batch_size, num_channels_latents, height, width = latents.shape
optional_kwargs = {}
if "ref_image_hidden_states" in set(inspect.signature(self.transformer.forward).parameters.keys()):
optional_kwargs["ref_image_hidden_states"] = ref_image_hidden_states