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

Bittensor-version-update #251

Merged
merged 10 commits into from
Jan 22, 2025
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
7 changes: 4 additions & 3 deletions compute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
import string

# Define the version of the template module.
__version__ = "1.7.4"
__minimal_miner_version__ = "1.6.0"
__minimal_validator_version__ = "1.7.3"

__version__ = "1.8.0"
__minimal_miner_version__ = "1.8.0"
__minimal_validator_version__ = "1.8.0"

version_split = __version__.split(".")
__version_as_int__ = (100 * int(version_split[0])) + (10 * int(version_split[1])) + (1 * int(version_split[2]))
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

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'inspect' is not used.


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 @@

# 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
8 changes: 2 additions & 6 deletions neurons/register_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1733,12 +1733,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
25 changes: 16 additions & 9 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,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 Expand Up @@ -1058,7 +1065,7 @@ def set_weights(self):
version_key=__version_as_int__,
wait_for_inclusion=False,
)
if isinstance(result, bool) and result or isinstance(result, tuple) and result[0]:
if isinstance(result[0], bool) and result or isinstance(result, tuple) and result[0]:
bt.logging.info(result)
bt.logging.success("✅ Successfully set weights.")
else:
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
Loading