From 2942f0afffb2a4d0bec01d6d1b7e067d50b80699 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 28 Jan 2023 15:01:28 -0500 Subject: [PATCH 1/3] call method with netuid --- bittensor/_neuron/text/core_validator/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bittensor/_neuron/text/core_validator/__init__.py b/bittensor/_neuron/text/core_validator/__init__.py index 0d5fefb18d..1f4ada1ff8 100644 --- a/bittensor/_neuron/text/core_validator/__init__.py +++ b/bittensor/_neuron/text/core_validator/__init__.py @@ -513,8 +513,8 @@ def run_epoch( self ): # console table - weight table (every validation step) sample_uids, sample_weights = self.calculate_weights() self.vlogger.print_weights_table( - min_allowed_weights = self.subtensor.min_allowed_weights, - max_weight_limit = self.subtensor.max_weight_limit, + min_allowed_weights = self.subtensor.min_allowed_weights( netuid = self.config.netuid ), + max_weight_limit = self.subtensor.max_weight_limit( metuid = self.config.netuid ), neuron_stats = self.neuron_stats, title = str(self), metagraph_n = self.metagraph.n, @@ -559,8 +559,8 @@ def run_epoch( self ): if self.config.logging.debug or self.config.logging.trace: # console table - weight table (every end of epoch) self.vlogger.print_weights_table( - min_allowed_weights = self.subtensor.min_allowed_weights, - max_weight_limit = self.subtensor.max_weight_limit, + min_allowed_weights = self.subtensor.min_allowed_weights( netuid = self.config.netuid ), + max_weight_limit = self.subtensor.max_weight_limit( metuid = self.config.netuid ), neuron_stats = self.neuron_stats, title = str(self), metagraph_n = self.metagraph.n, From 57b462874e0bc82b05b15d90e571750bd6e69cd5 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 28 Jan 2023 15:07:54 -0500 Subject: [PATCH 2/3] typo --- bittensor/_neuron/text/core_validator/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bittensor/_neuron/text/core_validator/__init__.py b/bittensor/_neuron/text/core_validator/__init__.py index 1f4ada1ff8..ef432997ca 100644 --- a/bittensor/_neuron/text/core_validator/__init__.py +++ b/bittensor/_neuron/text/core_validator/__init__.py @@ -514,7 +514,7 @@ def run_epoch( self ): sample_uids, sample_weights = self.calculate_weights() self.vlogger.print_weights_table( min_allowed_weights = self.subtensor.min_allowed_weights( netuid = self.config.netuid ), - max_weight_limit = self.subtensor.max_weight_limit( metuid = self.config.netuid ), + max_weight_limit = self.subtensor.max_weight_limit( netuid = self.config.netuid ), neuron_stats = self.neuron_stats, title = str(self), metagraph_n = self.metagraph.n, @@ -560,7 +560,7 @@ def run_epoch( self ): # console table - weight table (every end of epoch) self.vlogger.print_weights_table( min_allowed_weights = self.subtensor.min_allowed_weights( netuid = self.config.netuid ), - max_weight_limit = self.subtensor.max_weight_limit( metuid = self.config.netuid ), + max_weight_limit = self.subtensor.max_weight_limit( netuid = self.config.netuid ), neuron_stats = self.neuron_stats, title = str(self), metagraph_n = self.metagraph.n, From 837763ba1848d5cdd8eb31f4862214a8c1456fb6 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 28 Jan 2023 21:27:36 -0500 Subject: [PATCH 3/3] check numel first --- bittensor/_neuron/text/log_utilities.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bittensor/_neuron/text/log_utilities.py b/bittensor/_neuron/text/log_utilities.py index da8e865f97..3e06186c14 100644 --- a/bittensor/_neuron/text/log_utilities.py +++ b/bittensor/_neuron/text/log_utilities.py @@ -331,13 +331,20 @@ def print_weights_table( _neuron_stats = {uid: stats for uid, stats in _neuron_stats.items() if uid in limited_uids} print() + max_str: str = 'NA' + min_str: str = 'NA' + if sample_weights.numel() != 0: + # Has weights to print + max_str = f'{sample_weights.max().item():.4g}' + min_str = f'{sample_weights.min().item():.4g}' + self.print_stats_table(_neuron_stats, 'weight', f'[white] Neuron weights [/white] | ' + title, # title f'Validated {min_allowed_weights}/' f'[bold]{len(neuron_stats)}[/bold]/{metagraph_n} (min/[bold]valid[/bold]/total) | ' f'sum:{sample_weights.sum().item():.2g} ' - f'[white] max:[bold]{sample_weights.max().item():.4g}[/bold] / ' - f'min:[bold]{sample_weights.min().item():.4g}[/bold] [/white] ' + f'[white] max:[bold]{max_str}[/bold] / ' + f'min:[bold]{min_str}[/bold] [/white] ' f'\[{max_weight_limit:.4g} allowed]', # caption mark_uids=include_uids)