Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/transformers/integrations/integration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,12 @@ def setup(self, args, state, model, **kwargs):
- **SWANLAB_API_HOST** (`str`, *optional*, defaults to `None`):
API address for the SwanLab cloud environment for private version (its free)

- **SWANLAB_RUN_ID** (`str`, *optional*, defaults to `None`):
Experiment ID to resume a previous run. Use with `SWANLAB_RESUME` to continue an existing experiment.

- **SWANLAB_RESUME** (`str`, *optional*, defaults to `None`):
Resume mode (`"must"`, `"allow"`, `"never"`). Defaults to `"allow"` when `resume_from_checkpoint` is used.

"""
self._initialized = True

Expand All @@ -2301,6 +2307,16 @@ def setup(self, args, state, model, **kwargs):
init_args["experiment_name"] = trial_name
init_args["project"] = os.getenv("SWANLAB_PROJECT", None)

run_id = os.getenv("SWANLAB_RUN_ID", None)
if run_id is not None:
init_args["id"] = run_id

resume = os.getenv("SWANLAB_RESUME", None)
if resume is not None:
init_args["resume"] = resume
elif args.resume_from_checkpoint:
init_args["resume"] = "allow"

if self._swanlab.get_run() is None:
self._swanlab.init(
**init_args,
Expand Down