| 1 | from ltx_core.model.model_protocol import ModelConfigurator |
| 2 | from ltx_core.model.upsampler.model import LatentUpsampler |
| 3 | |
| 4 | |
| 5 | class LatentUpsamplerConfigurator(ModelConfigurator[LatentUpsampler]): |
| 6 | """ |
| 7 | Configurator for LatentUpsampler model. |
| 8 | Used to create a LatentUpsampler model from a configuration dictionary. |
| 9 | """ |
| 10 | |
| 11 | @classmethod |
| 12 | def from_config(cls: type[LatentUpsampler], config: dict) -> LatentUpsampler: |
| 13 | in_channels = config.get("in_channels", 128) |
| 14 | mid_channels = config.get("mid_channels", 512) |
| 15 | num_blocks_per_stage = config.get("num_blocks_per_stage", 4) |
| 16 | dims = config.get("dims", 3) |
| 17 | spatial_upsample = config.get("spatial_upsample", True) |
| 18 | temporal_upsample = config.get("temporal_upsample", False) |
| 19 | spatial_scale = config.get("spatial_scale", 2.0) |
| 20 | rational_resampler = config.get("rational_resampler", False) |
| 21 | return LatentUpsampler( |
| 22 | in_channels=in_channels, |
| 23 | mid_channels=mid_channels, |
| 24 | num_blocks_per_stage=num_blocks_per_stage, |
| 25 | dims=dims, |
| 26 | spatial_upsample=spatial_upsample, |
| 27 | temporal_upsample=temporal_upsample, |
| 28 | spatial_scale=spatial_scale, |
| 29 | rational_resampler=rational_resampler, |
| 30 | ) |
| 31 |