From e508a3eb87422d4562640f4fa58097d1bd1c4eb6 Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 21:43:50 -0500 Subject: [PATCH 01/16] data upload is optional --- snp_oracle/predictionnet/utils/config.py | 16 +++++- snp_oracle/predictionnet/validator/forward.py | 53 +++++++++++-------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/snp_oracle/predictionnet/utils/config.py b/snp_oracle/predictionnet/utils/config.py index 8930d99a..cdd51ae1 100644 --- a/snp_oracle/predictionnet/utils/config.py +++ b/snp_oracle/predictionnet/utils/config.py @@ -142,7 +142,21 @@ def add_args(cls, parser): "--neuron.organization", type=str, help="HuggingFace organization name for dataset storage", - default="foundryservices", + default="your_hugging_face_org", + ) + + parser.add_argument( + "--neuron.wandb_on" + type=bool, + help="Boolean toggle for wandb integration" + default=False + ) + + parser.add_argument( + "--neuron.data_upload_on" + type=bool, + help="Boolean toggle for validator HuggingFace data upload" + default=False ) # MINER ONLY CONFIG diff --git a/snp_oracle/predictionnet/validator/forward.py b/snp_oracle/predictionnet/validator/forward.py index c5b5ab94..50c72520 100644 --- a/snp_oracle/predictionnet/validator/forward.py +++ b/snp_oracle/predictionnet/validator/forward.py @@ -26,22 +26,17 @@ def can_process_data(response) -> bool: return all([bool(response.repo_id), bool(response.data), bool(response.decryption_key), bool(response.prediction)]) -async def process_miner_data(response, timestamp: str, organization: str, hotkey: str, uid: int) -> bool: +async def process_miner_data(response, timestamp: str, organization: str, hotkey: str, uid: int, data_upload_on: bool = False) -> bool: """ - Verify that miner's data can be decrypted and attempt to store it. - - Args: - response: Response from miner containing encrypted data - timestamp: Current timestamp - organization: Organization name for HuggingFace - hotkey: Miner's hotkey for data organization - uid: Miner's UID - - Returns: - bool: True if data was successfully decrypted, False otherwise + Verify that miner's data can be decrypted and optionally store it. """ try: bt.logging.info(f"Processing data from UID {uid}...") + + if not data_upload_on: + bt.logging.info(f"Data upload disabled, skipping storage for UID {uid}") + return True # Return True since this isn't a failure case + dataset_manager = DatasetManager(organization=organization) data_path = f"{response.repo_id}/{response.data}" @@ -72,9 +67,13 @@ async def process_miner_data(response, timestamp: str, organization: str, hotkey return False -async def handle_market_close(self, dataset_manager: DatasetManager) -> None: +async def handle_market_close(self, dataset_manager: DatasetManager, data_upload_on: bool) -> None: """Handle data management operations when market is closed.""" try: + if not data_upload_on: + bt.logging.info("Data upload disabled, skipping market close operations") + return + # Clean up old data dataset_manager.cleanup_local_storage(days_to_keep=2) @@ -100,16 +99,20 @@ async def forward(self): """ ny_timezone = timezone("America/New_York") current_time_ny = datetime.now(ny_timezone) - dataset_manager = DatasetManager(organization=self.config.neuron.organization) daily_ops_done = False + dataset_manager = None + data_upload_on = getattr(self.config.neuron, 'data_upload_on', False) + + if data_upload_on: + dataset_manager = DatasetManager(organization=self.config.neuron.organization) while True: if await self.is_valid_time(): daily_ops_done = False # Reset flag when market opens break - if not daily_ops_done: - await handle_market_close(self, dataset_manager) + if not daily_ops_done and data_upload_on and dataset_manager: + await handle_market_close(self, dataset_manager, data_upload_on) daily_ops_done = True # Check metagraph every hour @@ -161,6 +164,7 @@ async def forward(self): organization=self.config.neuron.organization, hotkey=self.metagraph.hotkeys[uid], uid=uid, + data_upload_on=data_upload_on ) decryption_tasks.append(task) else: @@ -175,14 +179,17 @@ async def forward(self): # Zero out rewards for failed decryption rewards = [reward if success else 0 for reward, success in zip(rewards, decryption_success)] - # Log results to wandb - wandb_val_log = { - "miners_info": { - miner_uid: {"miner_response": response.prediction, "miner_reward": reward, "decryption_success": success} - for miner_uid, response, reward, success in zip(miner_uids, responses, rewards, decryption_success) + wandb_on = self.config.neuron.wandb_on + + if wandb_on: + # Log results to wandb + wandb_val_log = { + "miners_info": { + miner_uid: {"miner_response": response.prediction, "miner_reward": reward, "decryption_success": success} + for miner_uid, response, reward, success in zip(miner_uids, responses, rewards, decryption_success) + } } - } - wandb.log(wandb_val_log) + wandb.log(wandb_val_log) # Log scores and update bt.logging.info(f"Scored responses: {rewards}") From 97fff4b4ccb63d5fe4269e015ac26d87dab5be92 Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 21:50:28 -0500 Subject: [PATCH 02/16] forgot commas --- snp_oracle/predictionnet/utils/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snp_oracle/predictionnet/utils/config.py b/snp_oracle/predictionnet/utils/config.py index cdd51ae1..c03e8165 100644 --- a/snp_oracle/predictionnet/utils/config.py +++ b/snp_oracle/predictionnet/utils/config.py @@ -146,14 +146,14 @@ def add_args(cls, parser): ) parser.add_argument( - "--neuron.wandb_on" + "--neuron.wandb_on", type=bool, help="Boolean toggle for wandb integration" default=False ) parser.add_argument( - "--neuron.data_upload_on" + "--neuron.data_upload_on", type=bool, help="Boolean toggle for validator HuggingFace data upload" default=False From 14961634b2b7704aad821ec328884fcd5e00b73a Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 21:51:59 -0500 Subject: [PATCH 03/16] updates --- snp_oracle/predictionnet/utils/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snp_oracle/predictionnet/utils/config.py b/snp_oracle/predictionnet/utils/config.py index c03e8165..7348fa54 100644 --- a/snp_oracle/predictionnet/utils/config.py +++ b/snp_oracle/predictionnet/utils/config.py @@ -148,14 +148,14 @@ def add_args(cls, parser): parser.add_argument( "--neuron.wandb_on", type=bool, - help="Boolean toggle for wandb integration" + help="Boolean toggle for wandb integration", default=False ) parser.add_argument( "--neuron.data_upload_on", type=bool, - help="Boolean toggle for validator HuggingFace data upload" + help="Boolean toggle for validator HuggingFace data upload", default=False ) From d184059a1fb8159c230f9827e1fef8e5a45364ea Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 22:19:03 -0500 Subject: [PATCH 04/16] more changes --- docs/validators.md | 7 +++++++ snp_oracle/neurons/validator.py | 1 + snp_oracle/predictionnet/validator/forward.py | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/validators.md b/docs/validators.md index 4e4437b1..6da3bf13 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -78,6 +78,13 @@ Before starting the process, validators would be required to procure a WANDB API #### HuggingFace Access Token A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. +#### Optional Miner Data Upload to Hugging Face +Optionally, validators can choose to upload miner data at the end of each day to Hugging Face. The goal of this is to increase the transparency of our subnet. In order to participate, validators will need to create a Hugging Face organization: . + +Once you have created an organization, pass the organization namespace into the ```--neuron.organization``` argument in the Makefile with your organizations namespace. + +To turn on this feature, you will also need to add the ```--neuron.data_upload_on``` argument to the Makefile and set it to ```True```. + #### Git Access Token A git token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. Be sure to scope this token to the organization repository. The `username`, `name`, and `email` environment variable properties are all tied to your HuggingFace account. diff --git a/snp_oracle/neurons/validator.py b/snp_oracle/neurons/validator.py index 29fa3a2e..dafa97cc 100644 --- a/snp_oracle/neurons/validator.py +++ b/snp_oracle/neurons/validator.py @@ -51,6 +51,7 @@ def __init__(self, config=None): wandb.init( project=f"sn{self.config.netuid}-validators", + mode="disabled" if not getattr(self.config.neuron, 'wandb_on', False) else "online", entity="foundryservices", config={ "hotkey": self.wallet.hotkey.ss58_address, diff --git a/snp_oracle/predictionnet/validator/forward.py b/snp_oracle/predictionnet/validator/forward.py index 50c72520..5e4c2ac0 100644 --- a/snp_oracle/predictionnet/validator/forward.py +++ b/snp_oracle/predictionnet/validator/forward.py @@ -177,7 +177,7 @@ async def forward(self): rewards = get_rewards(self, responses=responses, miner_uids=miner_uids) # Zero out rewards for failed decryption - rewards = [reward if success else 0 for reward, success in zip(rewards, decryption_success)] + #rewards = [reward if success else 0 for reward, success in zip(rewards, decryption_success)] wandb_on = self.config.neuron.wandb_on From 6d693ef7d836f4f7a83abfc6a2da22482c4330ba Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 22:31:44 -0500 Subject: [PATCH 05/16] update docs --- docs/validators.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/validators.md b/docs/validators.md index 6da3bf13..03ec7cb5 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -60,15 +60,17 @@ Update the `.env` file with your validator's values. ```text WANDB_API_KEY='REPLACE_WITH_WANDB_API_KEY' HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY' -GIT_TOKEN='REPLACE_WITH_GIT_TOKEN' -GIT_USERNAME='REPLACE_WITH_GIT_USERNAME' -GIT_NAME="REPLACE_WITH_GIT_NAME" -GIT_EMAIL="REPLACE_WITH_GIT_EMAIL" + +(Optional - See Miner Data Upload to Hugging Face section) +GIT_TOKEN='REPLACE_WITH_GIT_TOKEN' +GIT_USERNAME='REPLACE_WITH_GIT_USERNAME' +GIT_NAME='REPLACE_WITH_GIT_NAME' +GIT_EMAIL='REPLACE_WITH_GIT_EMAIL' ``` See WandB API Key and HuggingFace setup below. -#### Obtain & Setup WandB API Key +#### (Optional) Obtain & Setup WandB API Key Before starting the process, validators would be required to procure a WANDB API Key. Please follow the instructions mentioned below:
- Log in to Weights & Biases and generate an API key in your account settings. @@ -78,15 +80,15 @@ Before starting the process, validators would be required to procure a WANDB API #### HuggingFace Access Token A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. -#### Optional Miner Data Upload to Hugging Face +#### (Optional) Miner Data Upload to Hugging Face Optionally, validators can choose to upload miner data at the end of each day to Hugging Face. The goal of this is to increase the transparency of our subnet. In order to participate, validators will need to create a Hugging Face organization: . Once you have created an organization, pass the organization namespace into the ```--neuron.organization``` argument in the Makefile with your organizations namespace. To turn on this feature, you will also need to add the ```--neuron.data_upload_on``` argument to the Makefile and set it to ```True```. -#### Git Access Token -A git token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. Be sure to scope this token to the organization repository. The `username`, `name`, and `email` environment variable properties are all tied to your HuggingFace account. +#### (Optional) Git Access Token +A git token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. Be sure to scope this token to the organization repository set with the argument above. The `username`, `name`, and `email` environment variable properties are all tied to your HuggingFace account. ## Deploying a Validator **IMPORTANT** From 2661ad11436869dcace0883a30c87cf3e15cb175 Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 22:44:38 -0500 Subject: [PATCH 06/16] one more update --- docs/validators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/validators.md b/docs/validators.md index 03ec7cb5..44047f08 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -70,7 +70,7 @@ GIT_EMAIL='REPLACE_WITH_GIT_EMAIL' See WandB API Key and HuggingFace setup below. -#### (Optional) Obtain & Setup WandB API Key +#### Obtain & Setup WandB API Key Before starting the process, validators would be required to procure a WANDB API Key. Please follow the instructions mentioned below:
- Log in to Weights & Biases and generate an API key in your account settings. From 97053d5a0ef14aaf1831ea4c8044b1a67da6abfc Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 23:03:43 -0500 Subject: [PATCH 07/16] update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8c024aaf..16bc413c 100644 --- a/Makefile +++ b/Makefile @@ -54,5 +54,5 @@ miner: --logging.$(logging_level) \ --vpermit_tao_limit 2 \ --blacklist.force_validator_permit true \ - --hf_repo_id foundryservices/mining_models \ + --hf_repo_id your_repo_id \ --model mining_models/base_lstm_new.h5 From 30b7362e8466919d622072b55a731d395910fc1e Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 23:29:46 -0500 Subject: [PATCH 08/16] precommit hooks --- docs/validators.md | 6 +- snp_oracle/neurons/validator.py | 2 +- snp_oracle/predictionnet/utils/config.py | 9 +-- snp_oracle/predictionnet/validator/forward.py | 65 ++++++++++--------- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/docs/validators.md b/docs/validators.md index 44047f08..88224dc4 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -62,8 +62,8 @@ WANDB_API_KEY='REPLACE_WITH_WANDB_API_KEY' HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY' (Optional - See Miner Data Upload to Hugging Face section) -GIT_TOKEN='REPLACE_WITH_GIT_TOKEN' -GIT_USERNAME='REPLACE_WITH_GIT_USERNAME' +GIT_TOKEN='REPLACE_WITH_GIT_TOKEN' +GIT_USERNAME='REPLACE_WITH_GIT_USERNAME' GIT_NAME='REPLACE_WITH_GIT_NAME' GIT_EMAIL='REPLACE_WITH_GIT_EMAIL' ``` @@ -81,7 +81,7 @@ Before starting the process, validators would be required to procure a WANDB API A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. #### (Optional) Miner Data Upload to Hugging Face -Optionally, validators can choose to upload miner data at the end of each day to Hugging Face. The goal of this is to increase the transparency of our subnet. In order to participate, validators will need to create a Hugging Face organization: . +Optionally, validators can choose to upload miner data at the end of each day to Hugging Face. The goal of this is to increase the transparency of our subnet. In order to participate, validators will need to create a Hugging Face organization: . Once you have created an organization, pass the organization namespace into the ```--neuron.organization``` argument in the Makefile with your organizations namespace. diff --git a/snp_oracle/neurons/validator.py b/snp_oracle/neurons/validator.py index dafa97cc..3ab590be 100644 --- a/snp_oracle/neurons/validator.py +++ b/snp_oracle/neurons/validator.py @@ -51,7 +51,7 @@ def __init__(self, config=None): wandb.init( project=f"sn{self.config.netuid}-validators", - mode="disabled" if not getattr(self.config.neuron, 'wandb_on', False) else "online", + mode="disabled" if not getattr(self.config.neuron, "wandb_on", False) else "online", entity="foundryservices", config={ "hotkey": self.wallet.hotkey.ss58_address, diff --git a/snp_oracle/predictionnet/utils/config.py b/snp_oracle/predictionnet/utils/config.py index 7348fa54..a44fc885 100644 --- a/snp_oracle/predictionnet/utils/config.py +++ b/snp_oracle/predictionnet/utils/config.py @@ -145,18 +145,13 @@ def add_args(cls, parser): default="your_hugging_face_org", ) - parser.add_argument( - "--neuron.wandb_on", - type=bool, - help="Boolean toggle for wandb integration", - default=False - ) + parser.add_argument("--neuron.wandb_on", type=bool, help="Boolean toggle for wandb integration", default=False) parser.add_argument( "--neuron.data_upload_on", type=bool, help="Boolean toggle for validator HuggingFace data upload", - default=False + default=False, ) # MINER ONLY CONFIG diff --git a/snp_oracle/predictionnet/validator/forward.py b/snp_oracle/predictionnet/validator/forward.py index 5e4c2ac0..b7dcd7c7 100644 --- a/snp_oracle/predictionnet/validator/forward.py +++ b/snp_oracle/predictionnet/validator/forward.py @@ -26,17 +26,19 @@ def can_process_data(response) -> bool: return all([bool(response.repo_id), bool(response.data), bool(response.decryption_key), bool(response.prediction)]) -async def process_miner_data(response, timestamp: str, organization: str, hotkey: str, uid: int, data_upload_on: bool = False) -> bool: +async def process_miner_data( + response, timestamp: str, organization: str, hotkey: str, uid: int, data_upload_on: bool = False +) -> bool: """ Verify that miner's data can be decrypted and optionally store it. """ try: bt.logging.info(f"Processing data from UID {uid}...") - + if not data_upload_on: bt.logging.info(f"Data upload disabled, skipping storage for UID {uid}") return True # Return True since this isn't a failure case - + dataset_manager = DatasetManager(organization=organization) data_path = f"{response.repo_id}/{response.data}" @@ -91,6 +93,22 @@ async def handle_market_close(self, dataset_manager: DatasetManager, data_upload bt.logging.error(f"Error during market close operations: {str(e)}") +def log_to_wandb(wandb_on, miner_uids, responses, rewards, decryption_success): + if wandb_on: + # Log results to wandb + wandb_val_log = { + "miners_info": { + miner_uid: { + "miner_response": response.prediction, + "miner_reward": reward, + "decryption_success": success, + } + for miner_uid, response, reward, success in zip(miner_uids, responses, rewards, decryption_success) + } + } + wandb.log(wandb_val_log) + + async def forward(self): """ The forward function is called by the validator every time step. @@ -101,35 +119,29 @@ async def forward(self): current_time_ny = datetime.now(ny_timezone) daily_ops_done = False dataset_manager = None - data_upload_on = getattr(self.config.neuron, 'data_upload_on', False) + data_upload_on = getattr(self.config.neuron, "data_upload_on", False) if data_upload_on: dataset_manager = DatasetManager(organization=self.config.neuron.organization) while True: if await self.is_valid_time(): + bt.logging.info("Market is open. Begin processes requests") daily_ops_done = False # Reset flag when market opens break + else: + bt.logging.info("Market is closed. Sleeping for 2 minutes...") + time.sleep(120) # Sleep for 5 minutes before checking again + if datetime.now(ny_timezone) - current_time_ny >= timedelta(hours=1): + self.resync_metagraph() + self.set_weights() + self.past_predictions = [full((self.N_TIMEPOINTS, self.N_TIMEPOINTS), nan)] * len(self.hotkeys) + current_time_ny = datetime.now(ny_timezone) if not daily_ops_done and data_upload_on and dataset_manager: await handle_market_close(self, dataset_manager, data_upload_on) daily_ops_done = True - # Check metagraph every hour - if datetime.now(ny_timezone) - current_time_ny >= timedelta(hours=1): - self.resync_metagraph() - self.set_weights() - self.past_predictions = [full((self.N_TIMEPOINTS, self.N_TIMEPOINTS), nan)] * len(self.hotkeys) - current_time_ny = datetime.now(ny_timezone) - - time.sleep(120) # Sleep for 2 minutes - - if datetime.now(ny_timezone) - current_time_ny >= timedelta(hours=1): - self.resync_metagraph() - self.set_weights() - self.past_predictions = [full((self.N_TIMEPOINTS, self.N_TIMEPOINTS), nan)] * len(self.hotkeys) - current_time_ny = datetime.now(ny_timezone) - # Get available miner UIDs miner_uids = [] for uid in range(len(self.metagraph.S)): @@ -164,7 +176,7 @@ async def forward(self): organization=self.config.neuron.organization, hotkey=self.metagraph.hotkeys[uid], uid=uid, - data_upload_on=data_upload_on + data_upload_on=data_upload_on, ) decryption_tasks.append(task) else: @@ -177,19 +189,12 @@ async def forward(self): rewards = get_rewards(self, responses=responses, miner_uids=miner_uids) # Zero out rewards for failed decryption - #rewards = [reward if success else 0 for reward, success in zip(rewards, decryption_success)] + # rewards = [reward if success else 0 for reward, success in zip(rewards, decryption_success)] wandb_on = self.config.neuron.wandb_on - if wandb_on: - # Log results to wandb - wandb_val_log = { - "miners_info": { - miner_uid: {"miner_response": response.prediction, "miner_reward": reward, "decryption_success": success} - for miner_uid, response, reward, success in zip(miner_uids, responses, rewards, decryption_success) - } - } - wandb.log(wandb_val_log) + wandb_on = self.config.neuron.wandb_on + log_to_wandb(wandb_on, miner_uids, responses, rewards, decryption_success) # Log scores and update bt.logging.info(f"Scored responses: {rewards}") From ea1c0dad9b7490359e3aa70720df9375c8d7e00c Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sat, 11 Jan 2025 23:35:52 -0500 Subject: [PATCH 09/16] cleanup --- snp_oracle/predictionnet/validator/forward.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/snp_oracle/predictionnet/validator/forward.py b/snp_oracle/predictionnet/validator/forward.py index b7dcd7c7..11ad4368 100644 --- a/snp_oracle/predictionnet/validator/forward.py +++ b/snp_oracle/predictionnet/validator/forward.py @@ -30,7 +30,15 @@ async def process_miner_data( response, timestamp: str, organization: str, hotkey: str, uid: int, data_upload_on: bool = False ) -> bool: """ - Verify that miner's data can be decrypted and optionally store it. + Verify that miner's data can be decrypted and attempt to store it. + Args: + response: Response from miner containing encrypted data + timestamp: Current timestamp + organization: Organization name for HuggingFace + hotkey: Miner's hotkey for data organization + uid: Miner's UID + Returns: + bool: True if data was successfully decrypted, False otherwise """ try: bt.logging.info(f"Processing data from UID {uid}...") @@ -191,8 +199,6 @@ async def forward(self): # Zero out rewards for failed decryption # rewards = [reward if success else 0 for reward, success in zip(rewards, decryption_success)] - wandb_on = self.config.neuron.wandb_on - wandb_on = self.config.neuron.wandb_on log_to_wandb(wandb_on, miner_uids, responses, rewards, decryption_success) From aa1ae826a4a5aceb37cd728dce092bdd2b586006 Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sun, 12 Jan 2025 08:20:25 -0500 Subject: [PATCH 10/16] fix tag in vali readme --- docs/validators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/validators.md b/docs/validators.md index 88224dc4..dbee9837 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -81,7 +81,7 @@ Before starting the process, validators would be required to procure a WANDB API A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. #### (Optional) Miner Data Upload to Hugging Face -Optionally, validators can choose to upload miner data at the end of each day to Hugging Face. The goal of this is to increase the transparency of our subnet. In order to participate, validators will need to create a Hugging Face organization: . +Optionally, validators can choose to upload miner data at the end of each day to Hugging Face. The goal of this is to increase the transparency of our subnet. In order to participate, validators will need to create a Hugging Face organization. Once you have created an organization, pass the organization namespace into the ```--neuron.organization``` argument in the Makefile with your organizations namespace. From d08c3302abc65555b24e011ced158c349531d6b2 Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sun, 12 Jan 2025 08:22:00 -0500 Subject: [PATCH 11/16] more doc updates --- docs/validators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/validators.md b/docs/validators.md index dbee9837..71d39a89 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -88,7 +88,7 @@ Once you have created an organization, pass the organization namespace into the To turn on this feature, you will also need to add the ```--neuron.data_upload_on``` argument to the Makefile and set it to ```True```. #### (Optional) Git Access Token -A git token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. Be sure to scope this token to the organization repository set with the argument above. The `username`, `name`, and `email` environment variable properties are all tied to your HuggingFace account. +A git token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. Be sure to scope this token to the organization repository set with the argument above. The `GIT_TOKEN`, `GIT_USERNAME`, `GIT_EMAIL` and `GIT_NAME` environment variable properties are all tied to your HuggingFace account. ## Deploying a Validator **IMPORTANT** From 23149e320ab740616e9403dfafb137bbec7472d6 Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sun, 12 Jan 2025 08:42:21 -0500 Subject: [PATCH 12/16] add miner and vali specific templates. Add HF_COLLECTION_SLUG to .env.validator.template --- .env.miner.template | 1 + .env.template => .env.validator.template | 8 ++++---- docs/miners.md | 4 ++-- docs/validators.md | 11 +++++++++-- 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .env.miner.template rename .env.template => .env.validator.template (50%) diff --git a/.env.miner.template b/.env.miner.template new file mode 100644 index 00000000..0acf7b65 --- /dev/null +++ b/.env.miner.template @@ -0,0 +1 @@ +MINER_HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY' diff --git a/.env.template b/.env.validator.template similarity index 50% rename from .env.template rename to .env.validator.template index 7bf9ea67..6e0602f5 100644 --- a/.env.template +++ b/.env.validator.template @@ -1,10 +1,10 @@ -# Copy the contents on this file to a new file called .env WANDB_API_KEY='REPLACE_WITH_WANDB_API_KEY' -MINER_HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY' + HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY' +HF_COLLECTION_SLUG='REPLACE_WITH_HUGGINGFACE_COLLECTION_SLUG' # Git credentials GIT_TOKEN='REPLACE_WITH_GIT_TOKEN' GIT_USERNAME='REPLACE_WITH_GIT_USERNAME' -GIT_NAME="REPLACE_WITH_GIT_NAME" -GIT_EMAIL="REPLACE_WITH_GIT_EMAIL" +GIT_NAME='REPLACE_WITH_GIT_NAME' +GIT_EMAIL='REPLACE_WITH_GIT_EMAIL' diff --git a/docs/miners.md b/docs/miners.md index 6a3db448..3fa6f80d 100644 --- a/docs/miners.md +++ b/docs/miners.md @@ -57,10 +57,10 @@ poetry install ## Configuration #### Environment Variables -First copy the `.env.template` file to `.env` +First copy the `.env.miner.template` file to `.env` ```shell -cp .env.template .env +cp .env.miner.template .env ``` Update the `.env` file with your miner's values for the following properties. diff --git a/docs/validators.md b/docs/validators.md index 71d39a89..71ed9617 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -49,17 +49,19 @@ poetry install ## Configuration #### Environment Variables -First copy the `.env.template` file to `.env` +First copy the `.env.validator.template` file to `.env` ```shell -cp .env.template .env +cp .env.validator.template .env ``` Update the `.env` file with your validator's values. ```text WANDB_API_KEY='REPLACE_WITH_WANDB_API_KEY' + HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY' +HF_COLLECTION_SLUG='REPLACE_WITH_HUGGINGFACE_COLLECTION_SLUG' (Optional - See Miner Data Upload to Hugging Face section) GIT_TOKEN='REPLACE_WITH_GIT_TOKEN' @@ -80,6 +82,11 @@ Before starting the process, validators would be required to procure a WANDB API #### HuggingFace Access Token A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. +#### HuggingFace Collection Slug +A Hugging Face collection is where the references to miner models will be stored. In order to create one, follow the steps mentioned here. + +Once you have created a collection, copy and paste the collection slug into the HF_COLLECTION_SLUG environment variable. + #### (Optional) Miner Data Upload to Hugging Face Optionally, validators can choose to upload miner data at the end of each day to Hugging Face. The goal of this is to increase the transparency of our subnet. In order to participate, validators will need to create a Hugging Face organization. From 3ced188f718a429c6abdca959b85bff5c7743c24 Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sun, 12 Jan 2025 09:09:24 -0500 Subject: [PATCH 13/16] more docs updates --- Makefile | 2 +- docs/validators.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 16bc413c..bf7ae621 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ netuid = $(localnet_netuid) network = $(localnet) logging_level = debug # options= ['info', 'debug', 'trace'] - ################################################################################ # Network Parameters # ################################################################################ @@ -44,6 +43,7 @@ validator: --netuid $(netuid) \ --logging.$(logging_level) + miner: pm2 start python --name miner -- ./snp_oracle/neurons/miner.py \ --wallet.name $(coldkey) \ diff --git a/docs/validators.md b/docs/validators.md index 71ed9617..798eda11 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -80,7 +80,7 @@ Before starting the process, validators would be required to procure a WANDB API - Finally, run `wandb login` and paste your API key. Now you're all set with weights & biases. #### HuggingFace Access Token -A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. +A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. Ensure that your access token has all repository permissions and collection permissions checked. #### HuggingFace Collection Slug A Hugging Face collection is where the references to miner models will be stored. In order to create one, follow the steps mentioned here. From 42fcf3aad632c2862286e2c29414f16eae102f5c Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sun, 12 Jan 2025 09:25:13 -0500 Subject: [PATCH 14/16] release notes --- docs/Release Notes.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/Release Notes.md b/docs/Release Notes.md index 83e3e28e..1152329f 100644 --- a/docs/Release Notes.md +++ b/docs/Release Notes.md @@ -1,6 +1,13 @@ Release Notes ============= +3.0.1 +----- +Released on January 12 2025 +- Improvements in validator README instructions +- Add flags to opt into additional functionality + + 3.0.0 ----- Released on January 10th 2025 From f0110e3b880d95125764e46983538216050cf14d Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sun, 12 Jan 2025 09:28:21 -0500 Subject: [PATCH 15/16] more readme updates --- docs/validators.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/validators.md b/docs/validators.md index 798eda11..e15ea6ce 100644 --- a/docs/validators.md +++ b/docs/validators.md @@ -80,12 +80,12 @@ Before starting the process, validators would be required to procure a WANDB API - Finally, run `wandb login` and paste your API key. Now you're all set with weights & biases. #### HuggingFace Access Token -A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token. Ensure that your access token has all repository permissions and collection permissions checked. +A huggingface access token can be procured from the huggingface platform. Follow the steps mentioned here to get your huggingface access token and add it to the ```HF_ACCESS_TOKEN``` environment variable. Ensure that your access token has all repository permissions and collection permissions checked. #### HuggingFace Collection Slug A Hugging Face collection is where the references to miner models will be stored. In order to create one, follow the steps mentioned here. -Once you have created a collection, copy and paste the collection slug into the HF_COLLECTION_SLUG environment variable. +Once you have created a collection, copy and paste the collection slug into the ```HF_COLLECTION_SLUG``` environment variable. #### (Optional) Miner Data Upload to Hugging Face Optionally, validators can choose to upload miner data at the end of each day to Hugging Face. The goal of this is to increase the transparency of our subnet. In order to participate, validators will need to create a Hugging Face organization. From 62ed608f9eb409e0d839f9032e7fd1b39e2159eb Mon Sep 17 00:00:00 2001 From: Peter Carlson Date: Sun, 12 Jan 2025 09:29:02 -0500 Subject: [PATCH 16/16] update test and project version --- pyproject.toml | 2 +- tests/test_package.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9aa64a42..22d21207 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "snp_oracle" -version = "3.0.0" +version = "3.0.1" description = "" authors = ["Foundry Digital"] readme = "README.md" diff --git a/tests/test_package.py b/tests/test_package.py index 46c0775d..749dc267 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -11,4 +11,4 @@ def setUp(self): def test_package_version(self): # Check that version is as expected # Must update to increment package version successfully - self.assertEqual(__version__, "3.0.0") + self.assertEqual(__version__, "3.0.1")