src/transformers/configuration_utils.py
def to_diff_dict(self) -> Dict[str, Any]:
        """
        Removes all attributes from config which correspond to the default config attributes for better readability and
        serializes to a Python dictionary.

        Returns:
            :obj:`Dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance,
        """
        config_dict = self.to_dict()

        # get the default config dict
        default_config_dict = PretrainedConfig().to_dict()

        # get class specific config dict
        class_config_dict = self.__class__().to_dict() if not self.is_composition else {}

        serializable_config_dict = {}

        # only serialize values that differ from the default config
        for key, value in config_dict.items():
            if (
                key not in default_config_dict
                or key == "transformers_version"
                or value != default_config_dict[key]
                or (key in class_config_dict and value != class_config_dict[key])
            ):
                serializable_config_dict[key] = value

        return serializable_config_dict

        Removes all attributes from config which correspond to the default config attributes for better readability and
        serializes to a Python dictionary.

        Returns:
            :obj:`Dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance,
        
Removes all attributes from config which correspond to the default config attributes for better readability and
serializes to a Python dictionary.
Removes all attributes from config which correspond to the default config attributes for better readability and serializes to a Python dictionary .
def to_diff_dict(self) -> Dict[str, Any]:
        config_dict = self.to_dict()
        default_config_dict = PretrainedConfig().to_dict()
        class_config_dict = self.__class__().to_dict() if not self.is_composition else {}
        serializable_config_dict = {}
        for key, value in config_dict.items():
            if (
                key not in default_config_dict
                or key == "transformers_version"
                or value != default_config_dict[key]
                or (key in class_config_dict and value != class_config_dict[key])
            ):
                serializable_config_dict[key] = value
        return serializable_config_dict
def to_diff_dict ( self ) -> Dict [ str , Any ] : config_dict = self . to_dict ( ) default_config_dict = PretrainedConfig ( ) . to_dict ( ) class_config_dict = self . __class__ ( ) . to_dict ( ) if not self . is_composition else { } serializable_config_dict = { } for key , value in config_dict . items ( ) : if ( key not in default_config_dict or key == "transformers_version" or value != default_config_dict [ key ] or ( key in class_config_dict and value != class_config_dict [ key ] ) ) : serializable_config_dict [ key ] = value return serializable_config_dict
Removes all attributes from config which correspond to the default config attributes for better readability and
serializes to a Python dictionary.
Removes all attributes from config which correspond to the default config attributes for better readability and serializes to a Python dictionary .
"""
        Removes all attributes from config which correspond to the default config attributes for better readability and
        serializes to a Python dictionary.

        Returns:
            :obj:`Dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance,
        """ # get the default config dict # get class specific config dict # only serialize values that differ from the default config
:obj:`Dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance.
: obj : ` Dict [ str Any ] ` : Dictionary of all the attributes that make up this configuration instance .
self