{"record":{"id":"5c3f9b84a9951d89","repo":"Stability-AI/generative-models","slug":"unknown-merge-strategy-merge-strategy","errorCode":null,"errorMessage":"unknown merge strategy {merge_strategy}","messagePattern":"unknown merge strategy (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sgm/modules/diffusionmodules/video_model.py","lineNumber":561,"sourceCode":"        time_embed_dim = self.in_channels * 4\n        self.time_mix_time_embed = nn.Sequential(\n            linear(self.in_channels, time_embed_dim),\n            nn.SiLU(),\n            linear(time_embed_dim, self.in_channels),\n        )\n\n        self.use_spatial_context = use_spatial_context\n\n        if merge_strategy == \"fixed\":\n            self.register_buffer(\"mix_factor\", th.Tensor([merge_factor]))\n        elif merge_strategy == \"learned\" or merge_strategy == \"learned_with_images\":\n            self.register_parameter(\n                \"mix_factor\", th.nn.Parameter(th.Tensor([merge_factor]))\n            )\n        elif merge_strategy == \"fixed_with_images\":\n            self.mix_factor = None\n        else:\n            raise ValueError(f\"unknown merge strategy {merge_strategy}\")\n\n        self.get_alpha_fn = functools.partial(\n            get_alpha,\n            merge_strategy,\n            self.mix_factor,\n            apply_sigmoid=apply_sigmoid_to_merge,\n        )\n\n    def forward(\n        self,\n        x: th.Tensor,\n        context: Optional[th.Tensor] = None,\n        # cam: Optional[th.Tensor] = None,\n        time_context: Optional[th.Tensor] = None,\n        timesteps: Optional[int] = None,\n        image_only_indicator: Optional[th.Tensor] = None,\n        conv_view: Optional[th.Tensor] = None,\n        conv_motion: Optional[th.Tensor] = None,","sourceCodeStart":543,"sourceCodeEnd":579,"githubUrl":"https://github.com/Stability-AI/generative-models/blob/e8cd657656fa5d61688191730d0e03242bf4ed44/sgm/modules/diffusionmodules/video_model.py#L543-L579","documentation":"The merge-strategy constructor in video_model.py (VideoResBlock path) accepts merge_strategy values including 'fixed_with_images'; anything else raises ValueError('unknown merge strategy {merge_strategy}'). The strategy determines how spatial and temporal features are blended via the mix_factor parameter.","triggerScenarios":"Creating a VideoResBlock (or similar) with merge_strategy not matching any known string — e.g. 'learned_with_images' when only 'fixed_with_images' plus the fixed/learned variants are supported at this site, or a typo like 'fixd'.","commonSituations":"Config values copied between AlphaBlender and VideoResBlock (their supported strategy sets differ), YAML typos, or overriding merge_strategy from the CLI with an invalid value.","solutions":["Use a supported merge_strategy: 'fixed', 'learned', or 'fixed_with_images' (whichever set this class documents).","Check that the strategy string matches exactly (case and underscores) the values in the constructor.","Validate config with a schema or assert against the supported list before model construction."],"exampleFix":"// before\nblock = VideoResBlock(..., merge_strategy=\"learned_with_images\")\n// after\nblock = VideoResBlock(..., merge_strategy=\"fixed_with_images\")","handlingStrategy":"validation","validationCode":"VALID = {\"fixed\", \"learned\", \"fixed_with_images\"}\nif merge_strategy not in VALID:\n    raise ValueError(f\"merge_strategy must be one of {VALID}, got {merge_strategy!r}\")","typeGuard":"def is_valid_video_merge_strategy(s) -> bool:\n    return isinstance(s, str) and s in {\"fixed\", \"learned\", \"fixed_with_images\"}","tryCatchPattern":"try:\n    block = VideoResBlock(..., merge_strategy=strategy)\nexcept ValueError as e:\n    logger.warning(\"%s; defaulting to 'fixed'\", e)\n    block = VideoResBlock(..., merge_strategy=\"fixed\")","preventionTips":["Keep a single constants module listing valid strategies per class.","Do not reuse AlphaBlender strategy strings for video blocks without checking support.","Add config schema validation with an enum before model build."],"tags":["pytorch","valueerror","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"e8cd657656fa5d61688191730d0e03242bf4ed44","analyzedAt":"2026-08-29T11:23:43.234Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}