Skip to content

Commit

Permalink
precommit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
richwardle committed Dec 19, 2024
1 parent 1b52fd2 commit c94a18b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion api_keys.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
2 changes: 1 addition & 1 deletion neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import multiprocessing as mp
import time

import torch
from loguru import logger

from prompting.api.api import start_scoring_api
Expand All @@ -19,7 +20,6 @@
from prompting.tasks.task_sending import task_sender
from prompting.weight_setting.weight_setter import weight_setter
from shared.profiling import profiler
import torch

torch.multiprocessing.set_start_method("spawn", force=True)

Expand Down
9 changes: 4 additions & 5 deletions prompting/api/scoring/api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import uuid
from typing import Any
from loguru import logger

from fastapi import APIRouter, Request
from fastapi import APIRouter, Depends, Header, HTTPException, Request
from loguru import logger

from prompting.llms.model_zoo import ModelZoo
from prompting.rewards.scoring import task_scorer
Expand All @@ -11,7 +11,6 @@
from shared.dendrite import DendriteResponseEvent
from shared.epistula import SynapseStreamResult
from shared.settings import shared_settings
from fastapi import Depends, HTTPException, Header

router = APIRouter()

Expand All @@ -28,9 +27,9 @@ async def score_response(request: Request, api_key_data: dict = Depends(validate
body = payload.get("body")

try:
if not body.get("model") is None:
if body.get("model") is not None:
model = ModelZoo.get_model_by_id(body.get("model"))
except Exception as e:
except Exception:
logger.warning(
f"Organic request with model {body.get('model')} made but the model cannot be found in model zoo. Skipping scoring."
)
Expand Down
3 changes: 1 addition & 2 deletions prompting/tasks/task_sending.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ruff: noqa: E402
import asyncio
import bittensor as bt
import time
from typing import List

import bittensor as bt
from loguru import logger

from prompting.miner_availability.miner_availability import miner_availabilities
Expand All @@ -16,7 +16,6 @@
from shared.epistula import query_miners
from shared.logging import ErrorLoggingEvent, ValidatorLoggingEvent
from shared.loop_runner import AsyncLoopRunner
from shared.misc import ttl_get_block
from shared.settings import shared_settings
from shared.timer import Timer

Expand Down
3 changes: 1 addition & 2 deletions shared/misc.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import asyncio
import bittensor as bt
import time
import traceback
from functools import lru_cache, update_wrapper
from math import floor
from typing import Any, Callable

import bittensor as bt
from loguru import logger

from shared.exceptions import BittensorError
from shared.settings import shared_settings


class classproperty:
Expand Down
2 changes: 1 addition & 1 deletion validator_api/gpt_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def stream_with_error_handling():
},
)
else:
logger.info(f"Forwarding response to scoring...")
logger.info("Forwarding response to scoring...")
asyncio.create_task(forward_response(uid=uid, body=body, chunks=response[1]))
return response[0]

Expand Down

0 comments on commit c94a18b

Please sign in to comment.