bittensor.extrinsics.log_utilities
#
Module Contents#
Classes#
Logger object for handling all logging function specific to validator. |
|
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_response_table(batch_predictions, stats, sort_col, task_repeat=4, tasks_per_server=3)#
Prints the query response table: top prediction probabilities and texts for batch tasks.
- Args:
- 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 (:type:`str`, required):
Column name used for sorting. Options from self.neuron_stats_columns[:, 1].
- task_repeat (:type:`int`, required):
The number of servers to compare against under the same set of task.
- tasks_per_server (:type:`int`, required):
How many tasks to show for each server.
- batch_predictions (
- 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).
- Args:
- 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 (:type:`str`, required):
Column name used for sorting. Options from self.neuron_stats_columns[:, 1].
- stats (
- Parameters:
stats (Dict) –
syn_loss_diff (Dict) –
sort_col (str) –
- print_stats_table(stats, sort_col, title, caption, mark_uids=None)#
Gathers data and constructs neuron statistics table and prints it.
- Args:
- stats (
Dict{Dict}
, required): Statistics per endpoint for this batch. In the format of {uid, {statistics}}.
- sort_col (:type:`str`, required):
Column name used for sorting. Options from self.neuron_stats_columns[:, 1].
- title (:type:`str`, required):
Title of the table.
- caption (:type:`str`, required):
Caption shown at the end of table.
- stats (
- print_synapse_table(name, stats, sort_col, start_time)#
Prints the evaluation of the neuron responses to the validator request
- Args:
- stats (
Dict{Dict}
, required): Statistics per endpoint for this batch. In the format of {uid, {statistics}}.
- sort_col (:type:`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.
- stats (
- 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.
- Args:
- min_allowed_weights (:type:`int`, required):
subtensor minimum allowed weight to set.
- max_weight_limit (:type:`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 (:type:`str`, required):
Title of the table.
- metagraph_n (:type:`int`, required):
Total number of uids in the metagraph.
- sample_uids (
torch.Tensor
, required): Uids to set weight for.
- sample_weights (
torch.Tensor
, required): Weights to set uids for.
- include_uids (:type:`list`, optional):
Set of uids to inculde in the table.
- num_rows (:type:`int`, optional):
Total number of uids to print in total.
- Parameters:
min_allowed_weights (int) –
max_weight_limit (int) –
neuron_stats (Dict) –
title (str) –
metagraph_n (int) –
sample_uids (torch.Tensor) –
sample_weights (torch.Tensor) –
include_uids (List) –
num_rows (int) –
- print_console_validator_identifier(uid, wallet, external_ip)#
Console print for validator identifier.
- print_console_metagraph_status(uid, metagraph, current_block, start_block, network, netuid)#
Console print for current validator’s metagraph status.
- 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.
- 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) –
- class bittensor.extrinsics.log_utilities.ValidatorPrometheus(config)#
- Prometheis logging object for validator.
- Args:
- config (
bittensor.Config
, optional): bittensor.server.config()
- config (
- log_run_info(parameters, uid, network, wallet)#
Set up prometheus running info.
- Parameters:
parameters (torch.nn.parameter.Parameter) –
uid (int) –
network (str) –
wallet (bittensor.wallet) –
- 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.
- log_step(current_block, last_update, step_time, loss)#
All prometheus logging at the each validation step.