Skip to content

Upgrade version #112

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 15 additions & 3 deletions cursor/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from dataclasses import dataclass
from dotenv import load_dotenv
import os
import argparse
import bittensor as bt

# Load environment variables from .env file
load_dotenv()
Expand All @@ -12,14 +14,24 @@ class Config:
wallet_name: str
wallet_hotkey: str
api_key: str
netuid: int
network: str

@staticmethod
def from_env() -> "Config":
parser = argparse.ArgumentParser(description="Bittensor example script")
parser.add_argument('--wallet.name', type=str, default="default", help="wallet name")
parser.add_argument('--wallet.hotkey', type=str, default="default", help="wallet hotkey")
parser.add_argument('--netuid', type=int, default=18, help="netuid")
parser.add_argument('--subtensor.chain_endpoint', type=str, default="finney", help="network name")
bt_config = bt.config(parser)
"""Load configuration from environment variables."""
return Config(
wallet_name=os.getenv("WALLET_NAME", "default"), # Default to an empty string if not set
wallet_hotkey=os.getenv("HOT_KEY", "default"),
api_key=os.getenv("CURSOR_API_KEY", "")
wallet_name=bt_config.wallet.name, # Default to an empty string if not set
wallet_hotkey=bt_config.wallet.hotkey,
api_key=os.getenv("CURSOR_API_KEY", ""),
netuid = bt_config.netuid,
network = "test" if "test" in bt_config.subtensor.chain_endpoint else "finney"
)


Expand Down
4 changes: 2 additions & 2 deletions cursor/app/core/query_to_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from cortext.dendrite import CortexDendrite
import traceback

subtensor = bt.subtensor(network="finney")
meta = subtensor.metagraph(netuid=18)
subtensor = bt.subtensor(network=config.network)
meta = subtensor.metagraph(netuid=config.netuid)
print("metagraph synched!")

# This needs to be your validator wallet that is running your subnet 18 validator
Expand Down
2 changes: 2 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ AWS_ACCESS_KEY=
AWS_SECRET_KEY=
CURSOR_API_KEY=

WALLET_NAME=default
HOT_KEY=default
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bittensor==8.4.3
bittensor==8.5.1
datasets==2.*
envparse==0.2.0
openai>=1.3.2, ==1.*
Expand All @@ -8,13 +8,13 @@ scikit-learn==1.*
torch==2.*
transformers==4.*
wandb==0.19.1
anthropic==0.19.2
anthropic==0.42.0
stability-sdk
boto3
anthropic_bedrock
pyOpenSSL==24.*
google-generativeai
groq==0.5.0
groq==0.13.1
aioboto3
tabulate
httpx==0.27.2
Expand Down
8 changes: 4 additions & 4 deletions start_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def update_and_restart(pm2_name, netuid, wallet_name, wallet_hotkey, address, au
f" --wallet.hotkey {wallet_hotkey} "
f" --netuid {netuid} "
f"--subtensor.chain_endpoint {address} "
f"--logging.level {logging} {wandb}"])
f"--logging.{logging} {wandb}"])
while True:
latest_version = get_version()
print(f"Current version: {current_version}")
Expand All @@ -37,7 +37,7 @@ def update_and_restart(pm2_name, netuid, wallet_name, wallet_hotkey, address, au
f" --wallet.hotkey {wallet_hotkey} "
f" --netuid {netuid} "
f"--subtensor.chain_endpoint {address} "
f"--logging.level {logging} {wandb}"])
f"--logging.{logging} {wandb}"])
current_version = latest_version

print("All up to date!")
Expand All @@ -55,14 +55,14 @@ def update_and_restart(pm2_name, netuid, wallet_name, wallet_hotkey, address, au
parser.add_argument("--netuid", required=False, default=18, help="netuid for validator")
parser.add_argument("--subtensor.chain_endpoint", required=False, default="wss://entrypoint-finney.opentensor.ai:443", dest="address")
parser.add_argument("--autoupdate", action='store_true', dest="autoupdate")
parser.add_argument("--logging", required=False, default="info")
parser.add_argument("--logging_level", choices=['info', 'debug', 'trace'], default='info')
parser.add_argument("--wandb_on", action='store_true', required=False, dest="wandb_on")
parser.add_argument("--max_miners_cnt", type=int, default=30)

args = parser.parse_args()

try:
update_and_restart(args.pm2_name, args.netuid, args.wallet_name, args.wallet_hotkey, args.address,
args.autoupdate, args.logging, args.wandb_on)
args.autoupdate, args.logging_level, args.wandb_on)
except Exception as e:
parser.error(f"An error occurred: {e}")
Loading