diff --git a/cursor/app/core/config.py b/cursor/app/core/config.py index ebecde22..6de0b5f2 100644 --- a/cursor/app/core/config.py +++ b/cursor/app/core/config.py @@ -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() @@ -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" ) diff --git a/cursor/app/core/query_to_validator.py b/cursor/app/core/query_to_validator.py index ab3cf516..8691f536 100644 --- a/cursor/app/core/query_to_validator.py +++ b/cursor/app/core/query_to_validator.py @@ -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 diff --git a/env.example b/env.example index 30db6755..8a256e2c 100644 --- a/env.example +++ b/env.example @@ -11,3 +11,5 @@ AWS_ACCESS_KEY= AWS_SECRET_KEY= CURSOR_API_KEY= +WALLET_NAME=default +HOT_KEY=default \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 7c2a320b..e4255ce8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -bittensor==8.4.3 +bittensor==8.5.1 datasets==2.* envparse==0.2.0 openai>=1.3.2, ==1.* @@ -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 diff --git a/start_validator.py b/start_validator.py index bcf2e160..969450fe 100644 --- a/start_validator.py +++ b/start_validator.py @@ -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}") @@ -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!") @@ -55,7 +55,7 @@ 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) @@ -63,6 +63,6 @@ def update_and_restart(pm2_name, netuid, wallet_name, wallet_hotkey, address, au 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}") \ No newline at end of file