scrub private information from simpletuner_config.json inside ckpt export#2741
Merged
bghira merged 1 commit intoJun 5, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the handling and sanitization of training configuration data before exporting it, particularly focusing on excluding sensitive information and improving serialization. It introduces new helper functions for key normalization and sensitive key detection, updates the serialization logic to handle more data types, and adds comprehensive tests to ensure sensitive fields are excluded from exported configs.
Improvements to configuration sanitization and serialization:
_EXCLUDED_TRAINING_CONFIG_KEYS,_SENSITIVE_TRAINING_CONFIG_KEY_PARTS,_SENSITIVE_TRAINING_CONFIG_KEYS) to define which config keys should be excluded or treated as sensitive, and implemented logic to skip these keys when serializing training configs (simpletuner/helpers/publishing/metadata.py)._normalise_training_config_keyand_should_skip_training_config_keyhelper functions to consistently identify and filter out sensitive or excluded keys during config export (simpletuner/helpers/publishing/metadata.py)._make_training_config_serializableto handle additional data types (such asEnum,Path,torch.dtype,torch.device,np.generic, andnp.ndarray) and to recursively sanitize nested structures, ensuring all exported config data is safe and JSON-serializable (simpletuner/helpers/publishing/metadata.py).Testing and validation:
test_save_training_config_sanitizes_public_export, to verify that sensitive fields are excluded and allowed fields are correctly serialized when saving training configs (tests/test_model_card.py).General code improvements:
Enum,Path,SimpleNamespace, andtempfile(simpletuner/helpers/publishing/metadata.py,tests/test_model_card.py) [1] [2] [3].