Skip to content

Conversation

Zeyi-Lin
Copy link
Member

@Zeyi-Lin Zeyi-Lin commented Jul 20, 2025

Description

Closes: #1198

swanlab offline
swanlab online
swanlab local
swanlab disabled

执行上述任一命令,会在swanlog目录下写入一个settings文件,用于保证在此目录下,未来的实验运行均符合规则。

@Zeyi-Lin Zeyi-Lin marked this pull request as ready for review July 20, 2025 06:46
@Zeyi-Lin Zeyi-Lin requested a review from SAKURA-CAT July 20, 2025 06:46
@Zeyi-Lin Zeyi-Lin self-assigned this Jul 20, 2025
@Zeyi-Lin Zeyi-Lin added the 💪 enhancement New feature or request label Jul 20, 2025
@SAKURA-CAT SAKURA-CAT force-pushed the feat/swanlab-offline-command branch from 0bec0bf to a253519 Compare September 23, 2025 09:53
Introduces FolderSettings for reading and writing INI-based configuration at the folder level, with validation for the mode field. Updates mode initialization logic to prioritize: explicit argument > environment variable > folder settings > default. Adds and extends tests to cover folder settings, mode priority, and error handling for configuration files.
Removed individual mode command files (disabled, local, offline, online) and consolidated their logic into swanlab/cli/commands/mode/__init__.py. Updated imports and CLI registration to use the new module. Centralized swanlog directory creation and settings writing logic in env.py and swanlab_settings, improving maintainability and reducing code duplication.
Changed create_swanlog_dir to accept None as default and defer get_swanlog_dir evaluation. Added extensive unit tests for directory creation, .gitignore handling, permission errors, parameter types, and edge cases to improve reliability and coverage.
Introduces a test to verify that when the user-provided logdir differs from the environment variable, settings are read from the environment variable as expected.
@SAKURA-CAT
Copy link
Member

offline 等 cli 的写入规则为:

只受环境变量控制,比如用户在环境变量设置SWANLAB_LOG_DIR为'./tmp',那么 offline 等配置写入位置为'./tmp/settings',如果此时用户在init 时init(logdir='./tmp-2'),offline 等信息依旧读取自'./tmp',日志文件将写入'./tmp-2'

@SAKURA-CAT SAKURA-CAT merged commit 5629d49 into main Sep 23, 2025
5 checks passed
@SAKURA-CAT SAKURA-CAT deleted the feat/swanlab-offline-command branch September 23, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REQUEST] swanlab offline/online/disabled

2 participants