synapse-alpha / mirror-neuron

Experiments on bittensor reward models to find exploits
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Sequential gating model #32

Closed steffencruz closed 1 year ago

steffencruz commented 1 year ago

Not yet working. Available uids as defined in sources/neuron.py:neuron:forward as

        available_uids = torch.tensor( [ uid for uid, ax in enumerate( self.metagraph.axons ) if ax.is_serving ], dtype = torch.int64 ).to( self.device )

is an inconsistent shape with the returned value of SequentialGatingModel.forward()

        scores = self.gating_model( unravelled_message ).to( self.device )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Running queries:
Template: QueryConfigTemplate(id='my_query', chunk_size=1, save_interval=100, message=None, ignore_attr=['hotkeys', 'block'], tokenizer=None, method={'name': 'train', 'args': {'max_iter': 10}})
  0%|                                                                                                                                       | 0/10 [00:00<?, ?it/s]2023-05-03 16:35:58.555 |       INFO       | forward()                     
Gating model response: tensor([[-0.1192,  0.0519, -0.0817, -0.3007, -0.0576, -0.1758,  0.0400,  0.0475,
         -0.0817, -0.0972,  0.0171, -0.1235,  0.0086, -0.3449, -0.0634, -0.0260,
         -0.0571, -0.2005,  0.1714,  0.0366,  0.0767,  0.2129, -0.0848,  0.1591,
         -0.2049,  0.0323,  0.3249,  0.0109, -0.1388,  0.2699, -0.0766,  0.1693,
         -0.1177, -0.0493, -0.2303,  0.1443, -0.1181,  0.0075, -0.1090, -0.1682,
          0.1071, -0.1403,  0.2597, -0.0507, -0.1027,  0.1130, -0.0014,  0.0163,
         -0.0291,  0.0555, -0.1305,  0.1813, -0.1292,  0.0525, -0.2480,  0.0127,
          0.1852, -0.1255, -0.1165, -0.1513,  0.0358, -0.2104,  0.1354, -0.0353,
          0.2633,  0.0674,  0.0583,  0.0128,  0.1605, -0.2542,  0.0646, -0.1153,
          0.2307,  0.0741,  0.1111, -0.2264,  0.0333,  0.0428,  0.1275,  0.1950,
          0.0144, -0.1264,  0.1170,  0.0953, -0.1494, -0.1012, -0.0942, -0.3011,
          0.0045,  0.0773, -0.1996, -0.1243,  0.0884, -0.0216, -0.0837,  0.0638,
         -0.1222, -0.1043,  0.1175, -0.0526,  0.0738, -0.0340, -0.1620,  0.0297,
          0.1386,  0.1519,  0.0946,  0.2772,  0.0626,  0.2318, -0.0564,  0.1582,
          0.1332,  0.0508,  0.1550,  0.2302, -0.1510,  0.0701, -0.0911,  0.0137,
         -0.0998,  0.1685,  0.1067,  0.0594,  0.0389,  0.0981,  0.1367, -0.0527,
         -0.0924,  0.0413,  0.0438,  0.2046, -0.0944,  0.0694,  0.0810, -0.0124,
         -0.0228,  0.0481, -0.2069,  0.0302,  0.1489, -0.0658, -0.1271,  0.0568,
          0.0376,  0.2140,  0.0106, -0.2103, -0.2041, -0.1320, -0.1075, -0.0122,
         -0.0236,  0.2903,  0.0222, -0.0063, -0.1066, -0.0923,  0.3293,  0.1483,
          0.0860,  0.2137,  0.2120, -0.0973,  0.0032, -0.1131,  0.2938, -0.0371,
         -0.2452,  0.0831,  0.1898,  0.2377, -0.2196,  0.1100,  0.0621, -0.1511,
         -0.0822, -0.0790, -0.0637, -0.0761, -0.1097, -0.1640, -0.1252, -0.0109,
          0.1020, -0.1228,  0.2601, -0.0629,  0.0567,  0.0789, -0.0820, -0.0646,
         -0.0217,  0.1081,  0.0010,  0.1368,  0.1096, -0.1419, -0.1104, -0.0533,
          0.1130,  0.2501, -0.2007,  0.1803, -0.0140, -0.0201, -0.1231,  0.2494,
         -0.0721, -0.1902,  0.0349,  0.0704,  0.0199, -0.0634, -0.1985,  0.1532,
          0.0620, -0.2012,  0.1274, -0.1109]], grad_fn=<SliceBackward0>)
Avaliable uids: tensor([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,
         14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,
         28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,
         42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,
         56,  57,  58,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,
         71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,
         85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  97,  98,
         99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
        113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
        127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
        141, 142, 143, 144, 145, 147, 148, 149, 150, 151, 152, 153, 154, 155,
        156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
        170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
        184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
        198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212,
        213, 214, 215, 216, 217, 218, 219])
Scores shape: torch.Size([1, 220]), available uids shape: torch.Size([217])
  0%|                                                                                                                                       | 0/10 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/Users/steffencruz/Desktop/py/bittensor/mirror_neuron/main.py", line 80, in <module>
    main()
  File "/Users/steffencruz/Desktop/py/bittensor/mirror_neuron/main.py", line 66, in main
    run_query(model=model, data=data)
  File "/Users/steffencruz/Desktop/py/bittensor/mirror_neuron/query.py", line 77, in run_query
    run_train(model)
  File "/Users/steffencruz/Desktop/py/bittensor/mirror_neuron/query.py", line 19, in run_train
    model.train(max_iter=1)
  File "/Users/steffencruz/Desktop/py/bittensor/mirror_neuron/sources/neuron.py", line 406, in train
    question = self.forward(
  File "/Users/steffencruz/Desktop/py/bittensor/mirror_neuron/sources/neuron.py", line 301, in forward
    self.gating_model.backward( scores = scores[ successful_uids ], rewards = rewards )
IndexError: index 113 is out of bounds for dimension 0 with size 1