fix train.log output (#14846) (#16281)

The bug was introduced in commit e3145103 ("import encryption for aistudio & fix sync bn"),
where the following snippet:
```
try:
    import encryption  # Attempt to import the encryption module for AIStudio's encryption model

    encrypted = encryption.is_encryption_needed()
except ImportError:
    get_logger().warning("Skipping import of the encryption module.")
    encrypted = False  # Encryption is not needed if the module cannot be imported
```
caused `get_logger()` to be called too early, initializing the logger before
the training arguments were passed. As a result, the training process
skipped proper log redirection, and `train.log` was not created.

This patch replaces the warning with a simple `print()` statement,
ensuring the logger is only initialized after training args are passed.

Fixes #14846
This commit is contained in:
刘维克
2025-08-20 18:30:33 +08:00
committed by GitHub
parent 30a6915eb3
commit b1a525301e
+1 -1
View File
@@ -32,7 +32,7 @@ try:
encrypted = encryption.is_encryption_needed()
except ImportError:
get_logger().warning("Skipping import of the encryption module.")
print("Skipping import of the encryption module.")
encrypted = False # Encryption is not needed if the module cannot be imported
__all__ = ["load_model"]