From e0dab5a99bdcbe8d4d4839b5ed352e5aef48254e Mon Sep 17 00:00:00 2001 From: steffenc Date: Fri, 18 Aug 2023 16:01:33 +0000 Subject: [PATCH 1/3] Stability fixes --- multigraph.py | 12 +++++++----- multistats.py | 12 ++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/multigraph.py b/multigraph.py index 7a9830e..c4c32fd 100644 --- a/multigraph.py +++ b/multigraph.py @@ -116,16 +116,18 @@ def parse_arguments(): if not args.no_dataframe: save_path = f'data/metagraph/{netuid}/df.parquet' - blocks = range(start_block, end_block, step_size) + blocks = sorted(range(start_block, end_block, -step_size)) df_loaded = None if os.path.exists(save_path): df_loaded = pd.read_parquet(save_path) blocks = [block for block in blocks if block not in df_loaded.block.unique()] print(f'Loaded dataframe from {save_path!r}. {len(df_loaded)} rows. {len(blocks)} blocks to process.') - if len(blocks)==0: - print('No blocks to process.') - sys.exit(0) - + + if len(blocks)==0: + print('No blocks to process.') + sys.exit(0) + + print(f'Loading metagraphs from {blocks[0]}-{blocks[-1]} ({len(blocks)}) to create dataframe.') df = load_metagraphs(blocks[0], blocks[-1], block_step=step_size, datadir=datadir) if df_loaded is not None: df = pd.concat([df, df_loaded], ignore_index=True) diff --git a/multistats.py b/multistats.py index 4552830..c9e80e5 100644 --- a/multistats.py +++ b/multistats.py @@ -16,6 +16,17 @@ api= wandb.Api(timeout=60) wandb.login(anonymous="allow") +import json +# Store the original json.loads +original_json_loads = json.loads + +def relaxed_json_loads(s, *args, **kwargs): + kwargs.pop("strict", None) # remove the strict argument if it exists + return original_json_loads(s, strict=False, *args, **kwargs) + +# Patch the library's json.loads +json.loads = relaxed_json_loads + def pull_wandb_runs(project='openvalidators', filters=None, min_steps=50, max_steps=100_000, ntop=10, netuid=None, summary_filters=None ): # TODO: speed this up by storing older runs @@ -265,6 +276,7 @@ def parse_arguments(): filters = None# {"tags": {"$in": [f'1.1.{i}' for i in range(10)]}} # filters={'tags': {'$in': ['5F4tQyWrhfGVcNhoqeiNsR6KjD4wMZ2kfhLj4oHYuyHbZAc3']}} # Is foundation validator + if args.load_runs and os.path.exists('data/wandb.csv'): df_runs = pd.read_csv('data/wandb.csv') assert len(df_runs) >= args.ntop, f'Loaded {len(df_runs)} runs, but expected at least {args.ntop}' From 29e0f00928036e9666fd0c006b0dc0b1616000f7 Mon Sep 17 00:00:00 2001 From: steffenc Date: Fri, 18 Aug 2023 16:01:57 +0000 Subject: [PATCH 2/3] Stability fixes --- multistats.py | 1 - 1 file changed, 1 deletion(-) diff --git a/multistats.py b/multistats.py index c9e80e5..66cffb4 100644 --- a/multistats.py +++ b/multistats.py @@ -275,7 +275,6 @@ def parse_arguments(): print(args) filters = None# {"tags": {"$in": [f'1.1.{i}' for i in range(10)]}} - # filters={'tags': {'$in': ['5F4tQyWrhfGVcNhoqeiNsR6KjD4wMZ2kfhLj4oHYuyHbZAc3']}} # Is foundation validator if args.load_runs and os.path.exists('data/wandb.csv'): df_runs = pd.read_csv('data/wandb.csv') From afadc94b74afef87cb5cab5941f83b13cb2e6bfa Mon Sep 17 00:00:00 2001 From: Steffen Cruz Date: Tue, 22 Aug 2023 08:37:50 -0600 Subject: [PATCH 3/3] Update multigraph.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Eduardo GarcĂ­a --- multigraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multigraph.py b/multigraph.py index c4c32fd..78df0ab 100644 --- a/multigraph.py +++ b/multigraph.py @@ -123,7 +123,7 @@ def parse_arguments(): blocks = [block for block in blocks if block not in df_loaded.block.unique()] print(f'Loaded dataframe from {save_path!r}. {len(df_loaded)} rows. {len(blocks)} blocks to process.') - if len(blocks)==0: + if len(blocks) == 0: print('No blocks to process.') sys.exit(0)