This is most likely not possible, but I just wanted to confirm it.
I have a yaml file with verbose variable names like stable_diffusion_server
, etc. But when I use hydra to read this data I do not want to use such a long variable name in my dataclass and would rather prefer something like this.
@dataclass
class AppConfig:
sd_server: str = MISSING
So, is it possible to use a different name in code instead of what is used in yaml file?
There is one hacky way that comes to mind. Basically use a pydantic validator and maybe delete that attribute and create a new one with the required name. But I don't think it would be worth it.
You can use interpolation to create an effective alias for that parameter.
from omegaconf import II
@dataclass
class AppConfig:
sd_server: str = MISSING
stable_diffusion_server: str = II("sd_server")
But in general, this will probably just make things more confusing for you. I suggest you decide on a single name and just stick to it in the code, config and command-line overrides.