{"record":{"id":"ffcfcbc00370698d","repo":"hpcaitech/Open-Sora","slug":"unknown-condition-type-cond-type","errorCode":null,"errorMessage":"Unknown condition type {cond_type}","messagePattern":"Unknown condition type (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"opensora/utils/inference.py","lineNumber":277,"sourceCode":"            r = r[:, -1:]\n            r_x = model_ae.encode(r.unsqueeze(0).to(device, dtype))\n            r_x = r_x.squeeze(0)  # size [C, T, H, W]\n            ref.append(r_x)\n        elif cond_type == \"i2v_loop\":\n            # first frame\n            r_head = read_from_path(ref_path[0], image_size, transform_name=\"resize_crop\")  # size [C, T, H, W]\n            r_head = r_head[:, :1]\n            r_x_head = model_ae.encode(r_head.unsqueeze(0).to(device, dtype))\n            r_x_head = r_x_head.squeeze(0)  # size [C, T, H, W]\n            ref.append(r_x_head)\n            # last frame\n            r_tail = read_from_path(ref_path[-1], image_size, transform_name=\"resize_crop\")  # size [C, T, H, W]\n            r_tail = r_tail[:, -1:]\n            r_x_tail = model_ae.encode(r_tail.unsqueeze(0).to(device, dtype))\n            r_x_tail = r_x_tail.squeeze(0)  # size [C, T, H, W]\n            ref.append(r_x_tail)\n        else:\n            raise NotImplementedError(f\"Unknown condition type {cond_type}\")\n\n        refs_x.append(ref)\n    return refs_x\n\n\ndef prepare_inference_condition(\n    z: torch.Tensor,\n    mask_cond: str,\n    ref_list: list[list[torch.Tensor]] = None,\n    causal: bool = True,\n) -> torch.Tensor:\n    \"\"\"\n    Prepare the visual condition for the model, using causal vae.\n\n    Args:\n        z (torch.Tensor): The latent noise tensor, of shape [B, C, T, H, W]\n        mask_cond (dict): The condition configuration.\n        ref_list: list of lists of media (image/video) for i2v and v2v condition, of shape [C, T', H, W]; len(ref_list)==B; ref_list[i] is the list of media for the generation in batch idx i, we use a list of media for each batch item so that it can have multiple references. For example, ref_list[i] could be [ref_image_1, ref_image_2] for i2v_loop condition.","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/hpcaitech/Open-Sora/blob/7ad6a96a135feb81f755c84fb391818718f6beb2/opensora/utils/inference.py#L259-L295","documentation":"collect_references_batch builds reference latents for image-to-video/video-continuation conditioning and only implements specific cond_type branches (each handling how many reference frames are read and encoded). An unrecognized cond_type string falls to the else and raises NotImplementedError.","triggerScenarios":"Calling collect_references_batch (directly or via run_inference / the Gradio api_fn) with a cond_type value not handled by the if/elif chain in this version — e.g. a new or misspelled condition type from the inference config.","commonSituations":"Using a cond_type from a different opensora version's docs (supported set changed between releases); typos in inference configs; forks adding new conditioning modes without extending this function.","solutions":["Check the if/elif chain just above the raise in opensora/utils/inference.py for the exact supported cond_type strings and use one of them","Fix typos/casing in your inference config's cond_type","If you need a new conditioning mode, add an elif branch that reads and encodes the references appropriately"],"exampleFix":"# before\nrefs = collect_references_batch(ref_path, cond_type=\"i2v_tail\")  # unsupported\n# after\nrefs = collect_references_batch(ref_path, cond_type=\"i2v\")  # exact supported value","handlingStrategy":"validation","validationCode":"import inspect, opensora.utils.inference as inf\nsrc = inspect.getsource(inf.collect_references_batch)\n# or hard-check the supported set from the if/elif chain:\nassert cond_type in SUPPORTED_COND_TYPES, f\"unsupported cond_type {cond_type!r}\"","typeGuard":"def is_supported_cond_type(ct: str, supported: set) -> bool:\n    return ct in supported","tryCatchPattern":"try:\n    refs = collect_references_batch(ref_path, cond_type=cond_type, ...)\nexcept NotImplementedError:\n    raise ValueError(f\"cond_type {cond_type!r} unsupported in this opensora version\") from None","preventionTips":["Pin the opensora version your config was written for","Read collect_references_batch's branches when adding conditioning modes","Validate cond_type against the version's supported set at startup"],"tags":["inference","conditioning","config","not-implemented"],"backgroundTag":"unsupported-enum-value","analyzedSha":"7ad6a96a135feb81f755c84fb391818718f6beb2","analyzedAt":"2026-08-28T16:58:37.171Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}