def save(self, path: str) -> None:
        """Save the current configuration instance to a JSON file.

        Ensures the parent directory exists and the file has a .json extension.

        Args:
            path: The target file path to save the configuration.

        Raises:
            ValueError: If the path is not a file with a .json extension.
        """
        os.makedirs(os.path.dirname(path), exist_ok=True)
        config_dict = {
            "version": self.version,
            "model": {
                "encoder": vars(self.model.encoder),
                "decoder": vars(self.model.decoder),
                "src_vocab_size": self.model.src_vocab_size,
                "tgt_vocab_size": self.model.tgt_vocab_size,
                "dropout": self.model.dropout,
                "normalization_layer_epsilon": self.model.normalization_layer_epsilon,
                "weight_dtype": self.model.weight_dtype,
                "rope_min_timescale": self.model.rope_min_timescale,
                "rope_max_timescale": self.model.rope_max_timescale,
                "sample_rate": self.model.sample_rate,
            },
            "training": vars(self.training),
            "data": vars(self.data),
        }
        with open(path, "w") as f:
            json.dump(config_dict, f, indent=2)
Save the current configuration instance to a JSON file.

        Ensures the parent directory exists and the file has a .json extension.

        Args:
            path: The target file path to save the configuration.

        Raises:
            ValueError: If the path is not a file with a .json extension.
        
mlx_audio/tts/models/dia/config.py