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

Features/reward flow updates #64

Merged
merged 6 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion prompting/baseminer/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def run(self):
# --- Check for registration.
if not self.subtensor.is_hotkey_registered(
netuid=self.config.netuid,
hotkey=self.wallet.hotkey.ss58_address,
hotkey_ss58=self.wallet.hotkey.ss58_address,
):
bt.logging.error(
f"Wallet: {self.wallet} is not registered on netuid {self.config.netuid}"
Expand Down
2 changes: 1 addition & 1 deletion prompting/validators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from . import event
from . import dataset

__version__ = "2.1.0"
__version__ = "2.1.1"
version_split = __version__.split(".")
__spec_version__ = (
(1000 * int(version_split[0]))
Expand Down
13 changes: 5 additions & 8 deletions prompting/validators/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ async def forward(self):

best_summary = summarization_event["best"]
exclude = summarization_event["uids"]
prompt_context = "### SUMMARY CONTEXT:\n" + best_summary
best_summary_context = "### SUMMARY CONTEXT:\n" + best_summary

for k in range(self.config.neuron.num_followup_steps):
# Get a followup question, given the summarized context.
qg_task = create_qg_task(base_text=prompt_context, index=k)
qg_task = create_qg_task(base_text=best_summary_context, index=k)
qg_event = await run_step(
self,
task=qg_task,
Expand All @@ -257,20 +257,17 @@ async def forward(self):

# Adds the best question to the prompt context.
best_question = qg_event["best"]
prompt_context += f"\n### QUESTION {k}:\n{best_question}"
best_question_prompt = best_summary_context + f"\n### QUESTION {k}:\n{best_question}"

qa_task = create_qa_task(prompt_context, index=k)
qa_task = create_qa_task(best_question_prompt, index=k)
qa_event = await run_step(
self,
task=qa_task,
k=self.config.neuron.answer_sample_size,
timeout=self.config.neuron.answer_timeout,
exclude=exclude,
)

best_answer = qa_event["best"]
prompt_context += f"\n### ANSWER {k}:\n{best_answer}"


exclude += qa_event["uids"]

self.blacklist.question_blacklist.append(qg_event["best"])
Expand Down
6 changes: 3 additions & 3 deletions prompting/validators/reward/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class DefaultRewardFrameworkConfig:
Note: All the weights should add up to 1.0.
"""

dpo_model_weight: float = 0.425
rlhf_model_weight: float = 0.15
reciprocate_model_weight: float = 0.425
dpo_model_weight: float = 0.6
rlhf_model_weight: float = 0
reciprocate_model_weight: float = 0.4
dahoas_model_weight: float = 0
prompt_model_weight: float = 0
5 changes: 3 additions & 2 deletions prompting/validators/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ def compose_prompt(self) -> str:
criteria_bullet_points_str = "\n".join(criteria_bullet_points)

prompt_template = textwrap.dedent(
"""\
"""\
Read the preceding context delimited with triple backticks carefully.
Your task is to provide a step-by-step answer to the last question found in the text, elaborating on your thought process:
Your task is to provide a a clear and direct answer to the last question found in the text.
p-ferreira marked this conversation as resolved.
Show resolved Hide resolved
Maintain an objective tone by sticking to factual information and logical deductions without personal opinions or emotional language:
'''{base_text}'''

The following criteria must be respected:
Expand Down
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ script="neurons/validators/validator.py"
autoRunLoc=$(readlink -f "$0")
proc_name="text_prompt_validators_main_process"
args=()
version_location="./prompting/__init__.py"
version_location="./prompting/validators/__init__.py"
version="__version__"

old_args=$@
Expand Down Expand Up @@ -229,7 +229,7 @@ if [ "$?" -eq 1 ]; then
if [ -d "./.git" ]; then

# check value on github remotely
latest_version=$(check_variable_value_on_github "opentensor/validators" "openvalidators/__init__.py" "__version__ ")
latest_version=$(check_variable_value_on_github "opentensor/text-prompting" "prompting/validators/__init__.py" "__version__ ")

# If the file has been updated
if version_less_than $current_version $latest_version; then
Expand Down