bittensor.extrinsics.log_utilities#

Module Contents#

Classes#

ValidatorLogger

Logger object for handling all logging function specific to validator.

ValidatorPrometheus

Prometheis logging object for validator.

class bittensor.extrinsics.log_utilities.ValidatorLogger(config=None)#

Logger object for handling all logging function specific to validator. Including console log styling, console table print and prometheus.

Parameters:

config (bittensor.Config(), optional) – bittensor.server.config()

print_console_metagraph_status(uid, metagraph, current_block, start_block, network, netuid)#

Console print for current validator’s metagraph status.

Parameters:
  • uid (int) –

  • metagraph (bittensor.Metagraph) –

  • current_block (int) –

  • start_block (int) –

  • network (str) –

  • netuid (int) –

print_console_query_summary(current_block, start_block, blocks_per_epoch, epoch_steps, epoch, responsive_uids, queried_uids, step_time, epoch_responsive_uids, epoch_queried_uids)#

Console print for query summary.

Parameters:
  • current_block (int) –

  • start_block (int) –

  • blocks_per_epoch (int) –

  • epoch_steps (int) –

  • epoch (int) –

  • responsive_uids (List) –

  • queried_uids (List) –

  • step_time (float) –

  • epoch_responsive_uids (Set) –

  • epoch_queried_uids (Set) –

print_console_subtensor_weight(sample_weights, epoch_responsive_uids, epoch_queried_uids, max_weight_limit, epoch_start_time)#

Console print for weight setting to subtensor.

Parameters:
  • sample_weights (torch.Tensor) –

  • epoch_responsive_uids (Set) –

  • epoch_queried_uids (Set) –

  • max_weight_limit (float) –

  • epoch_start_time (time.time) –

print_console_validator_identifier(uid, wallet, external_ip)#

Console print for validator identifier.

Parameters:
  • uid (int) –

  • wallet (bittensor.wallet) –

  • external_ip (str) –

print_response_table(batch_predictions, stats, sort_col, task_repeat=4, tasks_per_server=3)#

Prints the query response table with top prediction probabilities and texts for batch tasks.

Parameters:
  • batch_predictions (List[Union[str, Dict{torch.Tensor, str}]], required) – Predictions in string per task per uid. In the format of [(task, {uid, "prob: phrase" })] of length batch size.

  • stats (Dict{Dict}, required) – Statistics per endpoint for this batch. In the format of {uid, {statistics}}.

  • sort_col (str, required) – Column name used for sorting. Options from self.neuron_stats_columns[:, 1].

  • task_repeat (int, required) – The number of servers to compare against under the same set of task.

  • tasks_per_server (int, required) – How many tasks to show for each server.

print_stats_table(stats, sort_col, title, caption, mark_uids=None)#

Gathers data and constructs neuron statistics table and prints it.

Parameters:
  • stats (Dict{Dict}, required) – Statistics per endpoint for this batch. In the format of {uid, {statistics}}.

  • sort_col (str, required) – Column name used for sorting. Options from self.neuron_stats_columns[:, 1].

  • title (str, required) – Title of the table.

  • caption (str, required) – Caption shown at the end of table.

print_synapse_table(name, stats, sort_col, start_time)#

Prints the evaluation of the neuron responses to the validator request.

Parameters:
  • stats (Dict{Dict}, required) – Statistics per endpoint for this batch. In the format of {uid, {statistics}}.

  • sort_col (str, required) – Column name used for sorting. Options from self.neuron_stats_columns[:, 1].

  • name (str, required) – Name of synapse for the title of the table.

  • start_time (time.time, required) – Starting time for shapley calculation.

print_synergy_table(stats, syn_loss_diff, sort_col)#

Prints the synergy loss diff matrix with pairwise loss reduction due to synergy (original loss on diagonal).

Parameters:
  • stats (Dict{Dict}, required) – Statistics per endpoint for this batch. In the format of {uid, {statistics}}.

  • syn_loss_diff (Dict, required) – Dictionary table of pairwise synergies as loss reductions, with direct loss on diagonal.

  • sort_col (str, required) – Column name used for sorting. Options from self.neuron_stats_columns[:, 1].

print_weights_table(min_allowed_weights, max_weight_limit, neuron_stats, title, metagraph_n, sample_uids, sample_weights, include_uids=None, num_rows=None)#

Prints weights table given sample_uids and sample_weights.

Parameters:
  • min_allowed_weights (int, required) – subtensor minimum allowed weight to set.

  • max_weight_limit (int, required) – subtensor maximum allowed weight to set.

  • neuron_stats (Dict{Dict}, required) – Statistics per endpoint for this batch. In the format of {uid, {statistics}}.

  • title (str, required) – Title of the table.

  • metagraph_n (int, required) – Total number of ``uid``s in the metagraph.

  • sample_uids (torch.Tensor, required) – ``Uid``s to set weight for.

  • sample_weights (torch.Tensor, required) – Weights to set ``uid``s for.

  • include_uids (list, optional) – Set of ``uid``s to inculde in the table.

  • num_rows (int, optional) – Total number of ``uid``s to print in total.

class bittensor.extrinsics.log_utilities.ValidatorPrometheus(config)#

Prometheis logging object for validator.

Parameters:

config (bittensor.Config, optional) – bittensor.server.config()

log_epoch_end(uid, metagraph, current_block)#

All prometheus logging at the end of epoch.

Parameters:
  • uid (int) –

  • metagraph (bittensor.Metagraph) –

  • current_block (int) –

log_epoch_start(current_block, batch_size, sequence_length, validation_len, min_allowed_weights, blocks_per_epoch, epochs_until_reset)#

All prometheus logging at the start of epoch.

Parameters:
  • current_block (int) –

  • batch_size (int) –

  • sequence_length (int) –

  • validation_len (int) –

  • min_allowed_weights (int) –

  • blocks_per_epoch (int) –

  • epochs_until_reset (int) –

log_run_info(parameters, uid, network, wallet)#

Set up prometheus running info.

Parameters:
log_step(current_block, last_update, step_time, loss)#

All prometheus logging at the each validation step.

Parameters:
  • current_block (int) –

  • last_update (int) –

  • step_time (int) –

  • loss (int) –