Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cached synapses issue #118

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion image_generation_subnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from . import miner
from . import utils

__version__ = "0.1.10"
__version__ = "0.1.11"
version_split = __version__.split(".")
__spec_version__ = (
(1000 * int(version_split[0]))
Expand Down
2 changes: 1 addition & 1 deletion image_generation_subnet/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def add_args(cls, parser):
"--loop_base_time",
type=int,
help="The base time for the loop to run in seconds.",
default=600,
default=1800,
)

parser.add_argument(
Expand Down
32 changes: 18 additions & 14 deletions image_generation_subnet/validator/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,28 @@ def wrapper(*args, **kwargs):
def get_challenge(
url: str, synapses: List[ImageGenerating], backup_func: callable
) -> List[ImageGenerating]:
challenge = None
for i, synapse in tqdm(enumerate(synapses), total=len(synapses)):
if not synapse:
continue
try:
data = synapse.deserialize()
with httpx.Client(timeout=httpx.Timeout(60)) as client:
response = client.post(url, json=data)
if response.status_code != 200:
challenge = backup_func()
else:
challenge = response.json()
except Exception as e:
bt.logging.warning(f"Error in get_challenge: {e}")
challenge = backup_func()
if challenge:
synapses[i] = synapse.copy(update=challenge)
else:
synapses[i] = None
if not synapse:
continue
try:
data = synapse.deserialize()
with httpx.Client(timeout=httpx.Timeout(60)) as client:
response = client.post(url, json=data)
if response.status_code != 200:
challenge = backup_func()
else:
challenge = response.json()
except Exception as e:
bt.logging.warning(f"Error in get_challenge: {e}")
challenge = backup_func()
if challenge:
synapses[i] = synapse.copy(update=challenge)
else:
synapses[i] = None
return synapses

def get_reward_offline(
Expand Down
2 changes: 1 addition & 1 deletion neurons/validator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.0.0"
__version__ = "1.0.1"
version_split = __version__.split(".")
__spec_version__ = (
(1000 * int(version_split[0]))
Expand Down
5 changes: 3 additions & 2 deletions neurons/validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def forward(self):

bt.logging.info("Updating available models & uids")
async_batch_size = self.config.async_batch_size
loop_base_time = self.config.loop_base_time # default is 600 seconds
loop_base_time = self.config.loop_base_time
self.open_category_reward_synapses = self.init_reward_open_category_synapses()
threads = []
loop_start = time.time()
Expand Down Expand Up @@ -717,7 +717,8 @@ def prepare_challenge(self, uids_should_rewards, model_name, pipeline_type):
if info["model_name"] == model_name
]
)
batch_size = min(4, 1 + model_miner_count // 4)
# batch_size = min(4, 1 + model_miner_count // 4)
batch_size = 1

random.shuffle(uids_should_rewards)
batched_uids_should_rewards = [
Expand Down