From 6840d1fc4ca9acbb9c8d25c38378e287c1f171e0 Mon Sep 17 00:00:00 2001 From: Dmytro Bobrenko <17252809+dbobrenko@users.noreply.github.com> Date: Fri, 31 May 2024 11:39:58 +0000 Subject: [PATCH 1/3] Bittensor upgrade to 7.0.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9a91e8df0..994bdaaec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ angle_emb -bittensor==6.10.1 +bittensor==7.0.0 bs4 click==8.1.3 datasets==2.14.6 From e62c99fc6d1c270db447ab4b17059b088e0c02a7 Mon Sep 17 00:00:00 2001 From: Dmytro Bobrenko <17252809+dbobrenko@users.noreply.github.com> Date: Fri, 31 May 2024 11:42:16 +0000 Subject: [PATCH 2/3] Merge with staging --- prompting/base/validator.py | 3 +++ prompting/forward.py | 29 +++++++++++++---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/prompting/base/validator.py b/prompting/base/validator.py index 3ce252ee1..893bf2055 100644 --- a/prompting/base/validator.py +++ b/prompting/base/validator.py @@ -142,6 +142,9 @@ def run(self): self.loop.run_until_complete( asyncio.wait_for(task, timeout=forward_timeout) ) + except torch.cuda.OutOfMemoryError as e: + bt.logging.error(f"Out of memory error: {e}") + continue except MaxRetryError as e: bt.logging.error(f"MaxRetryError: {e}") continue diff --git a/prompting/forward.py b/prompting/forward.py index a92cb80bd..170f85254 100644 --- a/prompting/forward.py +++ b/prompting/forward.py @@ -16,28 +16,30 @@ # DEALINGS IN # THE SOFTWARE. -import asyncio -import random import sys import time +import random +import asyncio import traceback -from dataclasses import dataclass -from typing import Awaitable, Dict, List - -import bittensor as bt import numpy as np -import torch - +import bittensor as bt +from typing import List, Dict, Awaitable from prompting.agent import HumanAgent -from prompting.conversation import create_task from prompting.dendrite import DendriteResponseEvent +from prompting.conversation import create_task from prompting.protocol import StreamPromptingSynapse from prompting.rewards import RewardResult from prompting.tasks import QuestionAnsweringTask +from prompting.utils.uids import get_random_uids from prompting.utils.logging import log_event from prompting.utils.misc import async_log, serialize_exception_to_string -from prompting.utils.uids import get_random_uids +from dataclasses import dataclass +@async_log +async def generate_reference(agent): + loop = asyncio.get_running_loop() + result = await loop.run_in_executor(None, agent.task.generate_reference, agent.llm_pipeline) + return result @async_log async def execute_dendrite_call(dendrite_call): @@ -165,6 +167,7 @@ def log_stream_results(stream_results: List[StreamResult]): f"Failed response for uid {failed_response.uid}: {formatted_exception}" ) + async def run_step( self, agent: HumanAgent, roles: List[str], messages: List[str], k: int, timeout: float, exclude: list = None ): @@ -271,8 +274,6 @@ async def forward(self): """ Encapsulates a full conversation between the validator and miners. Contains one or more rounds of request-response. - Raises: - torch.cuda.OutOfMemoryError: CUDA out of memory error. """ bt.logging.info("🚀 Starting forward loop...") forward_start_time = time.time() @@ -353,10 +354,6 @@ async def forward(self): messages.append(agent.challenge) turn += 1 - except torch.cuda.OutOfMemoryError as err: - bt.logging.error("CUDA out of memory", str(err)) - raise err - except BaseException as e: unexpected_errors = serialize_exception_to_string(e) bt.logging.error( From 596e687d57d131c18722779b111fe30263f9c4cd Mon Sep 17 00:00:00 2001 From: Dmytro Bobrenko <17252809+dbobrenko@users.noreply.github.com> Date: Mon, 3 Jun 2024 13:59:21 +0000 Subject: [PATCH 3/3] Upgrade all requirements for vllm 0.4.2, specify versions --- requirements.txt | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index 994bdaaec..285483974 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,27 +1,29 @@ -angle_emb +angle_emb==0.4.4 bittensor==7.0.0 -bs4 +bs4==0.0.2 click==8.1.3 datasets==2.14.6 deprecation==2.1.0 -torch==2.1.1 +torch==2.3.0 torchmetrics -transformers==4.36.2 +transformers==4.41.2 pre-commit==3.3.2 git+https://github.com/synapse-alpha/mathgenerator.git@main#egg=mathgenerator numpy==1.22.0 -rouge +rouge==1.0.1 scipy==1.10.1 sentencepiece wandb==0.15.10 tenacity antlr4-python3-runtime==4.11 -wikipedia +wikipedia==1.4.0 openai==1.9.0 -langchain==0.1.5 +langchain==0.2.1 +langchain_core==0.2.3 langchainhub==0.1.14 -python-dotenv -wikipedia_sections -vllm -loguru -argostranslate \ No newline at end of file +python-dotenv==1.0.1 +wikipedia_sections==2.0.0 +vllm==0.4.3 +loguru==0.7.2 +argostranslate==1.9.6 +