From 56de3fc34a13095816e94869e8303ddb85a940ad Mon Sep 17 00:00:00 2001 From: Chengzhe Date: Sun, 16 Jun 2024 14:31:52 +0000 Subject: [PATCH 1/7] feat: Add PM2 installation commands to install.sh for streamlined setup - Update package list and install jq and npm - Install PM2 globally and update PM2 --- install.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/install.sh b/install.sh index 5b46c863c..410398f95 100644 --- a/install.sh +++ b/install.sh @@ -5,3 +5,12 @@ pip uninstall mathgenerator -y # Installing package from the current directory pip install -e . + +# Updating the package list and installing jq and npm +sudo apt update && sudo apt install -y jq npm + +# Installing PM2 globally +sudo npm install pm2 -g + +# Updating PM2 +pm2 update From 8e6ab40cb87f4ebf9426e4017f7d82c3562d2f71 Mon Sep 17 00:00:00 2001 From: Chengzhe Date: Tue, 18 Jun 2024 14:00:08 +0000 Subject: [PATCH 2/7] remove sudo from the commands in install.sh --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 410398f95..5e8c1d66a 100644 --- a/install.sh +++ b/install.sh @@ -7,10 +7,10 @@ pip uninstall mathgenerator -y pip install -e . # Updating the package list and installing jq and npm -sudo apt update && sudo apt install -y jq npm +apt update && apt install -y jq npm # Installing PM2 globally -sudo npm install pm2 -g +npm install pm2 -g # Updating PM2 pm2 update From 48136012f8a89ef63d03d14558de40048ff82a32 Mon Sep 17 00:00:00 2001 From: Chengzhe Date: Mon, 24 Jun 2024 00:47:54 +0000 Subject: [PATCH 3/7] update logging to use python rather than loguru refs #200 --- prompting/utils/config.py | 32 ++++++++++++++++---------------- prompting/utils/logging.py | 7 +++++-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/prompting/utils/config.py b/prompting/utils/config.py index a9382039c..c1f0823f6 100644 --- a/prompting/utils/config.py +++ b/prompting/utils/config.py @@ -20,9 +20,13 @@ import torch import argparse import bittensor as bt -from loguru import logger +import logging from prompting.tasks import TASKS +from bittensor.btlogging.defines import BITTENSOR_LOGGER_NAME + +logger = logging.getLogger(BITTENSOR_LOGGER_NAME) + def check_config(cls, config: "bt.Config"): r"""Checks/validates the config namespace object.""" @@ -42,20 +46,16 @@ def check_config(cls, config: "bt.Config"): if not os.path.exists(config.neuron.full_path): os.makedirs(config.neuron.full_path, exist_ok=True) - log_level_exists = "EVENTS" in logger._core.levels - if not config.neuron.dont_save_events and not log_level_exists: + if not config.neuron.dont_save_events: # Add custom event logger for the events. - logger.level("EVENTS", no=38, icon="📝") - logger.add( - os.path.join(config.neuron.full_path, "events.log"), - rotation=config.neuron.events_retention_size, - serialize=True, - enqueue=True, - backtrace=False, - diagnose=False, - level="EVENTS", - format="{time:YYYY-MM-DD at HH:mm:ss} | {level} | {message}", + event_handler = logging.FileHandler( + os.path.join(config.neuron.full_path, "events.log") ) + event_handler.setLevel(38) # Custom level + formatter = logging.Formatter("{asctime} | {levelname} | {message}", style="{") + event_handler.setFormatter(formatter) + logger.addHandler(event_handler) + logging.addLevelName(38, "EVENTS") def add_args(cls, parser): @@ -71,14 +71,14 @@ def add_args(cls, parser): help="Device to run on.", default="cuda" if torch.cuda.is_available() else "cpu", ) - + parser.add_argument( "--neuron.gpus", type=int, help="The number of visible GPUs to be considered in the llm initialization. This parameter currently reflects on the property `tensor_parallel_size` of vllm", default=1, ) - + parser.add_argument( "--neuron.llm_max_allowed_memory_in_gb", type=int, @@ -396,7 +396,7 @@ def add_validator_args(cls, parser): help="Only query a single hotkey per ip.", default=False, ) - + parser.add_argument( "--neuron.forward_max_time", type=int, diff --git a/prompting/utils/logging.py b/prompting/utils/logging.py index d7029b89c..61fb7fb3e 100644 --- a/prompting/utils/logging.py +++ b/prompting/utils/logging.py @@ -6,8 +6,11 @@ from dataclasses import asdict, dataclass from datetime import datetime from typing import List -from loguru import logger +import logging import prompting +from bittensor.btlogging.defines import BITTENSOR_LOGGER_NAME + +logger = logging.getLogger(BITTENSOR_LOGGER_NAME) @dataclass @@ -103,7 +106,7 @@ def reinit_wandb(self): def log_event(self, event): if not self.config.neuron.dont_save_events: - logger.log("EVENTS", "events", **event) + logger.log(38, "events", **event) if self.config.wandb.off: return From 39c487c70cbe0e847f2bdb95937141b015eb2188 Mon Sep 17 00:00:00 2001 From: bkb2135 <98138173+bkb2135@users.noreply.github.com> Date: Mon, 24 Jun 2024 08:23:57 -0400 Subject: [PATCH 4/7] Reduce timout to 15 seconds --- prompting/utils/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prompting/utils/config.py b/prompting/utils/config.py index a9382039c..79ccbf585 100644 --- a/prompting/utils/config.py +++ b/prompting/utils/config.py @@ -307,7 +307,7 @@ def add_validator_args(cls, parser): "--neuron.timeout", type=float, help="The timeout for each forward call in seconds.", - default=17, + default=15, ) parser.add_argument( From 3556e9781369465c522664f84665281ad23c04bb Mon Sep 17 00:00:00 2001 From: bkb2135 Date: Mon, 24 Jun 2024 17:36:59 +0000 Subject: [PATCH 5/7] Change event logging --- prompting/utils/logging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prompting/utils/logging.py b/prompting/utils/logging.py index 61fb7fb3e..50474b634 100644 --- a/prompting/utils/logging.py +++ b/prompting/utils/logging.py @@ -106,7 +106,7 @@ def reinit_wandb(self): def log_event(self, event): if not self.config.neuron.dont_save_events: - logger.log(38, "events", **event) + logger.log(38, event) if self.config.wandb.off: return From 03e77dc618bf303c14483d490811aa85c5f7b814 Mon Sep 17 00:00:00 2001 From: bkb2135 Date: Mon, 24 Jun 2024 17:46:27 +0000 Subject: [PATCH 6/7] Remove loguru requirement --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 79e0965cf..bb2b86b4e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,7 +28,6 @@ argostranslate==1.9.6 python-dotenv wikipedia_sections vllm -loguru argostranslate transformers==4.41.2 autoawq==0.2.5 From 18ed24e698fb14557ae5fdab8969d0b9b1bb3b69 Mon Sep 17 00:00:00 2001 From: bkb2135 Date: Mon, 24 Jun 2024 17:46:39 +0000 Subject: [PATCH 7/7] Increment Version Number --- prompting/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prompting/__init__.py b/prompting/__init__.py index 511c0c7b6..ead464f4e 100644 --- a/prompting/__init__.py +++ b/prompting/__init__.py @@ -16,7 +16,7 @@ # DEALINGS IN THE SOFTWARE. # Define the version of the template module. -__version__ = "2.5.0" +__version__ = "2.5.1" version_split = __version__.split(".") __spec_version__ = ( (10000 * int(version_split[0]))