Skip to content

Commit bd7c4e2

Browse files
authored
fixing wandb cache clean paths (#202)
1 parent 2461316 commit bd7c4e2

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.2
1+
3.0.3

bitmind/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.0.2"
1+
__version__ = "3.0.3"
22

33
version_split = __version__.split(".")
44
__spec_version__ = (

bitmind/wandb_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,14 @@ def clean_wandb_cache(wandb_dir, hours=1):
267267
wandb_dir: Directory containing wandb run files
268268
hours: Number of hours to keep runs for (default: 1)
269269
"""
270+
if not wandb_dir.endswith("wandb"):
271+
wandb_dir = os.path.join(wandb_dir, "wandb")
272+
270273
if not os.path.exists(wandb_dir):
271274
bt.logging.warning(f"W&B directory not found: {wandb_dir}")
272275
return
273276

277+
bt.logging.info(f"Attempting to clean wandb cache at {wandb_dir}")
274278
run_dirs = [
275279
d for d in glob.glob(os.path.join(wandb_dir, "run-*")) if os.path.isdir(d)
276280
]

neurons/generator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import bittensor as bt
3737
from bitmind.config import add_args, add_data_generator_args
3838
from bitmind.utils import ExitContext, get_metadata
39-
from bitmind.wandb_utils import init_wandb
39+
from bitmind.wandb_utils import init_wandb, clean_wandb_cache
4040
from bitmind.types import CacheConfig, MediaType, Modality
4141
from bitmind.cache.sampler import ImageSampler
4242
from bitmind.generation import (
@@ -86,6 +86,8 @@ def __init__(self):
8686
.metagraph(self.config.netuid)
8787
.hotkeys.index(self.wallet.hotkey.ss58_address)
8888
)
89+
self.wandb_dir = str(Path(__file__).parent.parent)
90+
clean_wandb_cache(self.wandb_dir)
8991
self.wandb_run = init_wandb(
9092
self.config.copy(),
9193
self.config.wandb.process_name,
@@ -222,6 +224,7 @@ async def run(self):
222224
if batch_count >= self.config.wandb.num_batches_per_run:
223225
batch_count = 0
224226
self.wandb_run.finish()
227+
clean_wandb_cache(self.wandb_dir)
225228
self.wandb_run = init_wandb(
226229
self.config.copy(),
227230
self.config.wandb.process_name,

0 commit comments

Comments
 (0)