Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/staging #651

Merged
merged 2 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions prompting/rewards/web_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import json
import os
from collections import defaultdict
from functools import lru_cache
from urllib.parse import urlparse

import numpy as np
Expand All @@ -19,6 +18,7 @@
from prompting.rewards.reward import BatchRewardOutput
from prompting.tasks.base_task import BaseTextTask
from shared.dendrite import DendriteResponseEvent
from shared.misc import async_lru_cache

MIN_RELEVANT_CHARS = 300
MIN_MATCH_THRESHOLD = 98
Expand Down Expand Up @@ -89,7 +89,7 @@ def __hash__(self):
# Use the id of the object as its hash
return hash(self.model_dump_json)

@lru_cache(maxsize=1000)
@async_lru_cache(maxsize=1000)
async def _cosine_similarity(self, content1: str, content2: str) -> float:
"""Calculate the cosine similarity between sentence embeddings of the reference and completions."""
reference_emb_flatten = self.embedding_model.encode(content1, to_numpy=True).flatten()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "prompting"
version = "2.17.6"
version = "2.17.7"
description = "Subnetwork 1 runs on Bittensor and is maintained by Macrocosmos. It's an effort to create decentralised AI"
authors = ["Kalei Brady, Dmytro Bobrenko, Felix Quinque, Steffen Cruz, Richard Wardle"]
readme = "README.md"
Expand Down