Validate checkpoint paths in config dictionary. Args: config: Configuration dictionary Raises: FileNotFoundError: If any checkpoint path in config does not exist
(config: dict)
| 718 | def check_path_exists(path: str) -> None: |
| 719 | """ |
| 720 | Check if a file path exists and raise an error if it doesn't. |
| 721 | |
| 722 | Args: |
| 723 | path: The file path to check |
| 724 | |
| 725 | Raises: |
| 726 | FileNotFoundError: If the path is not empty and the file does not exist |
| 727 | """ |
| 728 | if path and not path.startswith(("http://", "https://", "data:")): |
| 729 | if not os.path.exists(path): |
| 730 | raise FileNotFoundError(f"File does not exist: {path}") |
| 731 | |
| 732 | |
| 733 | def validate_config_paths(config: dict) -> None: |
| 734 | """ |
| 735 | Validate checkpoint paths in config dictionary. |
| 736 | |
| 737 | Args: |
| 738 | config: Configuration dictionary |
| 739 | |
| 740 | Raises: |
| 741 | FileNotFoundError: If any checkpoint path in config does not exist |
| 742 | """ |
| 743 | # Check DiT / adapter checkpoints |
| 744 | if "dit_quantized_ckpt" in config and config["dit_quantized_ckpt"] is not None: |
| 745 | check_path_exists(config["dit_quantized_ckpt"]) |
| 746 | logger.debug(f"✓ Verified dit_quantized_ckpt: {config['dit_quantized_ckpt']}") |
| 747 | |
| 748 | if "dit_original_ckpt" in config and config["dit_original_ckpt"] is not None: |
| 749 | check_path_exists(config["dit_original_ckpt"]) |
| 750 | logger.debug(f"✓ Verified dit_original_ckpt: {config['dit_original_ckpt']}") |
| 751 | |
| 752 | if config.get("model_cls") == "ltx2_5": |
| 753 | required_components = ( |
| 754 | "dit_original_ckpt", |
| 755 | "text_encoder_original_ckpt", |
| 756 | "video_vae_original_ckpt", |
| 757 | "audio_vae_original_ckpt", |
| 758 | ) |
| 759 | optional_components = ( |
| 760 | "duration_head_original_ckpt", |
| 761 | "upsampler_original_ckpt", |
| 762 | ) |
| 763 | for key in required_components: |
| 764 | value = config.get(key) |
| 765 | if not value: |
| 766 | raise ValueError(f"LTX-2.5 requires {key} in the config") |
| 767 | check_path_exists(value) |
| 768 | logger.debug(f"✓ Verified {key}: {value}") |
| 769 | for key in optional_components: |
no test coverage detected