Skip to content

Commit

Permalink
Merge pull request #233 from neuralinternet/bittensor-version-update
Browse files Browse the repository at this point in the history
Updating bittensor version to the latest. V 1.7.0
  • Loading branch information
GenesisOpp authored Jan 6, 2025
2 parents b9e7ec0 + 1aa0309 commit 5460ae1
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 36 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ target/
profile_default/
ipython_config.py

# wandb
wandb/

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Expand Down
11 changes: 8 additions & 3 deletions compute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import string

# Define the version of the template module.
__version__ = "1.6.1"
__minimal_miner_version__ = "1.6.0"
__minimal_validator_version__ = "1.6.1"
__version__ = "1.7.0"
__minimal_miner_version__ = "1.7.0"
__minimal_validator_version__ = "1.7.0"

version_split = __version__.split(".")
__version_as_int__ = (100 * int(version_split[0])) + (10 * int(version_split[1])) + (1 * int(version_split[2]))
Expand All @@ -34,6 +34,11 @@
# Time before the specs requests will time out. time unit = seconds
specs_timeout = 60

# Proof of GPU settings
pog_retry_limit = 30
pog_retry_interval = 80 # seconds


# Proof of GPU settings
pog_retry_limit = 30
pog_retry_interval = 80 # seconds
Expand Down
18 changes: 10 additions & 8 deletions compute/axon.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
import bittensor.utils.networking as net
import time
import uvicorn
from bittensor import axon, subtensor
from bittensor.axon import FastAPIThreadedServer, AxonMiddleware
from bittensor import axon
from bittensor.core.subtensor import Subtensor as subtensor

from bittensor.core.axon import FastAPIThreadedServer, AxonMiddleware
from fastapi import FastAPI, APIRouter
from rich.prompt import Confirm
from starlette.requests import Request
Expand All @@ -39,7 +41,7 @@


def serve_extrinsic(
subtensor: "bittensor.subtensor",
subtensor: "bittensor.core.subtensor",
wallet: "bittensor.wallet",
ip: str,
port: int,
Expand Down Expand Up @@ -250,16 +252,16 @@ def __init__(
if config is None:
config = axon.config()
config = copy.deepcopy(config)
config.axon.ip = ip or config.axon.get("ip", bittensor.defaults.axon.ip)
config.axon.port = port or config.axon.get("port", bittensor.defaults.axon.port)
config.axon.ip = ip or config.axon.get("ip", bittensor.core.settings.DEFAULTS.axon.ip)
config.axon.port = port or config.axon.get("port", bittensor.core.settings.DEFAULTS.axon.port)
config.axon.external_ip = external_ip or config.axon.get(
"external_ip", bittensor.defaults.axon.external_ip
"external_ip", bittensor.core.settings.DEFAULTS.axon.external_ip
)
config.axon.external_port = external_port or config.axon.get(
"external_port", bittensor.defaults.axon.external_port
"external_port", bittensor.core.settings.DEFAULTS.axon.external_port
)
config.axon.max_workers = max_workers or config.axon.get(
"max_workers", bittensor.defaults.axon.max_workers
"max_workers", bittensor.core.settings.DEFAULTS.axon.max_workers
)
axon.check_config(config)
self.config = config
Expand Down
6 changes: 3 additions & 3 deletions compute/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
import bittensor.utils.networking as net

import compute
import inspect


def prometheus_extrinsic(
subtensor: "bittensor.subtensor",
subtensor: "bittensor.core.subtensor.Subtensor.MockSubtensor",
wallet: "bittensor.wallet",
port: int,
netuid: int,
Expand Down Expand Up @@ -99,9 +100,8 @@ def prometheus_extrinsic(

# Add netuid, not in prometheus_info
call_params["netuid"] = netuid

bittensor.logging.info("Serving prometheus on: {}:{} ...".format(subtensor.network, netuid))
success, err = subtensor._do_serve_prometheus(
success, err = subtensor.do_serve_prometheus(
wallet=wallet,
call_params=call_params,
wait_for_finalization=wait_for_finalization,
Expand Down
2 changes: 1 addition & 1 deletion compute/utils/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from compute.utils.cache import ttl_cache

bt_blocktime = bt.__blocktime__
bt_blocktime = bt.BLOCKTIME


@ttl_cache(maxsize=1, ttl=bt_blocktime)
Expand Down
12 changes: 4 additions & 8 deletions neurons/register_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1668,12 +1668,8 @@ async def count_all_gpus() -> JSONResponse:
# Iterate through the miner specs details and print the table
for hotkey, details in specs_details.items():
if details :
gpu_miner = details["gpu"]
gpu_capacity = "{:.2f}".format(
(gpu_miner["capacity"] / 1024)
)
gpu_name = str(gpu_miner["details"][0]["name"]).lower()
gpu_count = gpu_miner["count"]
gpu_miner = details.get("gpu", "")
gpu_count = gpu_miner.get("count", 0)
GPU_COUNTS += gpu_count
bt.logging.info(f"API: List resources successfully")
return JSONResponse(
Expand Down Expand Up @@ -1819,7 +1815,7 @@ async def list_resources_wandb(query: ResourceQuery = None,
for hotkey, details in specs_details.items():

miner_older_than = self.miner_is_older_than(db, 48, hotkey)
miner_pog_ok = self.miner_pog_ok((db, 48, hotkey))
miner_pog_ok = self.miner_pog_ok(db, 48, hotkey)

if hotkey in running_hotkey and miner_pog_ok:
if details: # Check if details are not empty
Expand Down Expand Up @@ -3061,7 +3057,7 @@ def miner_is_older_than(self, db: ComputeDb, hours: int, ss58_address: str) -> b
cursor.close()

def miner_pog_ok(self, db: ComputeDb, hours: int, ss58_address: str) -> bool:
gpu_specs = get_pog_specs(self.db, ss58_address)
gpu_specs = get_pog_specs(db, ss58_address)
if gpu_specs is not None:
return True
else:
Expand Down
23 changes: 15 additions & 8 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,23 @@ def init_prometheus(self, force_update: bool = False):
"""
Register the prometheus information on metagraph.
:return: bool
"""
"""
# extrinsic prometheus is removed at 8.2.1

bt.logging.info("Extrinsic prometheus information on metagraph.")
success = self.subtensor.serve_prometheus(
wallet=self.wallet,
port=bt.defaults.axon.port,
netuid=self.config.netuid,
force_update=force_update,
)
success = True
# TODO : remove all the related code from the code base
# self._subtensor.serve_prometheus(
# wallet=self.wallet,
# port=bt.core.settings.DEFAULTS.axon.port,
# netuid=self.config.netuid,
# force_update=force_update,
# )
if success:
bt.logging.success(prefix="Prometheus served", sufix=f"<blue>Current version: {get_local_version()}</blue>")
bt.logging.success(
prefix="Prometheus served",
suffix=f"<blue>Current version: {get_local_version()}</blue>" # Corrected keyword
)
else:
bt.logging.error("Prometheus initialization failed")
return success
Expand Down
9 changes: 4 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
at==0.0.3
bittensor==6.9.4
bittensor==8.5.0
black==23.7.0
cryptography==42.0.0
cryptography==43.0.1
docker==7.0.0
GPUtil==1.4.0
igpu==0.1.2
numpy==1.26.3
numpy==2.0.2
psutil==5.9.8
pyinstaller==6.4.0
torch==2.1.2
wandb==0.16.6
wandb==0.19.1
pyfiglet==1.0.2
python-dotenv==1.0.1
requests==2.31.0
Expand Down

0 comments on commit 5460ae1

Please sign in to comment.