Skip to content

Commit

Permalink
fix issue for invalid provider and model
Browse files Browse the repository at this point in the history
  • Loading branch information
acer-king committed Oct 2, 2024
1 parent a5ecd4f commit da99a9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions validators/services/validators/base_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import bittensor as bt

from cortext.metaclasses import ValidatorRegistryMeta
from validators.utils import error_handler
from validators.utils import error_handler, get_bandwidth
from cortext.constants import TEXT_VALI_MODELS_WEIGHTS

dataset = None
Expand Down Expand Up @@ -135,7 +135,9 @@ def get_uid_to_scores_dict(self, uid_to_query_resps, scored_responses: tuple[flo
if model_weight is None:
bt.logging.debug(f"not weight found for this provider {provider} and model {model}")
model_weight = 0
band_width = uid_to_capacity.get(uid).get(f"{provider}").get(f"{model}")

band_width = get_bandwidth(uid_to_capacity, uid, provider, model)

if band_width is None:
bt.logging.debug(f"no band_width found for this uid {uid}")
band_width = 1
Expand Down
5 changes: 5 additions & 0 deletions validators/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,8 @@ def setup_max_capacity(item):
setup_max_capacity(value)
elif isinstance(value, (int, float)): # If the value is a number, increment by 5
item[key] = min(value, 100)


def get_bandwidth(data, uid, provider, model):
value = data.get(uid, {}).get(provider, {}).get(model, 0)
return value

0 comments on commit da99a9f

Please sign in to comment.