Coverage for src / autoencodix / configs / xmodalix_config.py: 73%

15 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-21 10:09 +0200

1from .default_config import DefaultConfig 

2 

3from pydantic import Field, model_validator 

4import warnings 

5from typing import Optional 

6 

7 

8class XModalixConfig(DefaultConfig): 

9 """ 

10 A specialized configuration inheriting from DefaultConfig. 

11 

12 This class overrides specific training parameters like pretrain_epochs and beta 

13 for the XModalix model, while inheriting all other settings. 

14 """ 

15 

16 pretrain_epochs: Optional[int] = Field( 

17 default=None, # Overridden default (was 0) 

18 description="Number of pretraining epochs, can be overwritten in DataInfo to have different number of pretraining epochs for each data modality", 

19 ) 

20 

21 beta: float = Field( 

22 default=0.1, # Overridden default (was 1.0) 

23 ge=0, 

24 description="Beta weighting factor for VAE loss", 

25 ) 

26 requires_paired: bool = Field(default=False) 

27 save_memory: bool = Field( 

28 default=False, 

29 description="Always False — not supported for Stackix.", 

30 ) 

31 

32 @model_validator(mode="before") 

33 def _force_save_memory_false(cls, values): 

34 if values.get("save_memory") is True: 

35 warnings.warn( 

36 "`save_memory=True` is not supported for XModalixConfig — forcing to False., Set the checkpoint_interval to number of epochs if you want to save memory", 

37 UserWarning, 

38 stacklevel=2, 

39 ) 

40 values["save_memory"] = False 

41 return values 

42 

43 # TODO find sensible defaults for XModalix