Skip to content

Commit

Permalink
remove wandb logs
Browse files Browse the repository at this point in the history
  • Loading branch information
surcyf123 authored Jan 30, 2024
1 parent 153becb commit c7e0b3e
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion validators/weight_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import bittensor as bt
import torch
import wandb
import os
import shutil

from template.protocol import IsAlive
from text_validator import TextValidator
Expand Down Expand Up @@ -74,6 +76,23 @@ async def consume_organic_scoring(self):
bt.logging.error(f'Encountered in {self.consume_organic_scoring.__name__} loop:\n{traceback.format_exc()}')
await asyncio.sleep(10)

def remove_directory(self, path):
# Remove wandb logs
try:
# Expands the '~' to the home directory
full_path = os.path.expanduser(path)

# Check if the directory exists
if os.path.exists(full_path):
# Recursively delete the directory and its contents
shutil.rmtree(full_path)
print(f"Successfully removed {full_path}")
else:
print(f"The directory {full_path} does not exist.")
except Exception as e:
bt.logging.error(f"error in remove directory {traceback.format_exc()}")


async def perform_synthetic_scoring_and_update_weights(self):
while True:
for steps_passed in itertools.count():
Expand All @@ -87,7 +106,7 @@ async def perform_synthetic_scoring_and_update_weights(self):
steps_since_last_update = steps_passed % iterations_per_set_weights

if steps_since_last_update == iterations_per_set_weights - 1:
# delete wandb logs
self.remove_directory('~/.bittensor/miners/')
await self.update_weights(steps_passed)
else:
bt.logging.info(
Expand Down

0 comments on commit c7e0b3e

Please sign in to comment.