Skip to content

Commit 7a5fc76

Browse files
authored
Merge branch 'staging' into backmerge/release-7.4.0
2 parents f531c8e + c7b4739 commit 7a5fc76

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

bittensor/metagraph.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ def state_dict(self):
468468
"bonds": self.bonds,
469469
"uids": self.uids,
470470
"axons": self.axons,
471+
"neurons": self.neurons,
471472
}
472473

473474
def sync(
@@ -790,6 +791,7 @@ def save(self) -> "metagraph": # type: ignore
790791
graph_filename = f"{save_directory}/block-{self.block.item()}.pt"
791792
state_dict = self.state_dict()
792793
state_dict["axons"] = self.axons
794+
state_dict["neurons"] = self.neurons
793795
torch.save(state_dict, graph_filename)
794796
state_dict = torch.load(
795797
graph_filename
@@ -1037,6 +1039,7 @@ def load_from_path(self, dir_path: str) -> "metagraph": # type: ignore
10371039
)
10381040
self.uids = torch.nn.Parameter(state_dict["uids"], requires_grad=False)
10391041
self.axons = state_dict["axons"]
1042+
self.neurons = state_dict["neurons"]
10401043
if "weights" in state_dict:
10411044
self.weights = torch.nn.Parameter(
10421045
state_dict["weights"], requires_grad=False
@@ -1181,6 +1184,7 @@ def load_from_path(self, dir_path: str) -> "metagraph": # type: ignore
11811184
self.last_update = state_dict["last_update"]
11821185
self.validator_permit = state_dict["validator_permit"]
11831186
self.axons = state_dict["axons"]
1187+
self.neurons = state_dict["neurons"]
11841188
if "weights" in state_dict:
11851189
self.weights = state_dict["weights"]
11861190
if "bonds" in state_dict:

tests/e2e_tests/subcommands/subnet/test_metagraph.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ def test_metagraph_command(local_chain, capsys):
8080
captured = capsys.readouterr()
8181

8282
# Assert the neuron is registered and displayed
83-
assert (
84-
"Metagraph: net: local:1" and "N: 1/1" in captured.out
85-
), "Neuron isn't displayed in metagraph"
83+
assert "Metagraph: net: local:1" in captured.out
84+
assert "N: 1/1" in captured.out, "Neuron isn't displayed in metagraph"
8685

8786
# Register Dave as neuron to the subnet
8887
dave_keypair, dave_exec_command, dave_wallet = setup_wallet("//Dave")
@@ -117,6 +116,7 @@ def test_metagraph_command(local_chain, capsys):
117116
captured = capsys.readouterr()
118117

119118
# Assert the neuron is registered and displayed
120-
assert "Metagraph: net: local:1" and "N: 2/2" in captured.out
119+
assert "Metagraph: net: local:1" in captured.out
120+
assert "N: 2/2" in captured.out
121121

122122
logging.info("Passed test_metagraph_command")

0 commit comments

Comments
 (0)