wandb-osh
raw JSON → 1.2.3 verified Sat May 09 auth: no python
Trigger W&B offline syncs from compute nodes without internet access. Current version: 1.2.3. Release cadence is irregular, with bug fixes and minor enhancements.
pip install wandb-osh Common errors
error ModuleNotFoundError: No module named 'wandb_osh' ↓
cause Library not installed or wrong import path.
fix
Install using: pip install wandb-osh
error AttributeError: module 'wandb_osh' has no attribute 'TriggerWandbSyncHook' ↓
cause Outdated version (<1.0.0) or trying to import from wrong submodule.
fix
Update to latest version: pip install --upgrade wandb-osh, then use: from wandb_osh import TriggerWandbSyncHook
error wandb.errors.error.UsageError: Mode must be 'offline' to use TriggerWandbSyncHook ↓
cause W&B initialized without mode='offline'.
fix
Call wandb.init(mode='offline', ...) before creating the trigger.
Warnings
gotcha wandb_osh.TriggerWandbSyncHook requires W&B to be initialized in offline mode. If mode is not set to 'offline', the hook may not work. ↓
fix Call wandb.init(mode='offline', ...) before using the hook.
deprecated The optional dependency 'pytorch-lightning' was replaced by 'lightning' (the new unified package) in v1.2.2. Installing 'pytorch-lightning' is deprecated. ↓
fix Install wandb-osh with 'lightning' extra: pip install wandb-osh[lightning]
gotcha In distributed training (e.g., DDP), the sync hook may trigger on every process, causing duplicate syncs. This was partially fixed in v1.2.3, but ensure only rank 0 triggers sync. ↓
fix Wrap trigger instantiation with a rank check: if dist.get_rank() == 0: trigger = TriggerWandbSyncHook()
breaking Python 3.7 support was dropped in v1.1.0. ↓
fix Use Python 3.8 or higher.
Imports
- wandb_osh wrong
from wandb_osh import WandbOSHcorrectimport wandb_osh - TriggerWandbSyncHook wrong
from wandb_osh.hooks import TriggerWandbSyncHookcorrectfrom wandb_osh import TriggerWandbSyncHook - wandb_osh.set_log_level wrong
wandb_osh.set_log_level(logging.INFO)correctwandb_osh.set_log_level('INFO')
Quickstart
import wandb_osh
import wandb
# Initialize W&B in offline mode
wandb.init(mode="offline", project="my_project")
# Create the sync trigger
trigger = wandb_osh.TriggerWandbSyncHook()
# Example: trigger sync after each run (e.g., at end of script)
# Note: In practice, the trigger runs in a background thread/process.
# For a full example, see the GitHub README.
print("Run completed. Sync will be triggered automatically.")