Skip to content
Open
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
14 changes: 7 additions & 7 deletions folding/registries/evaluation_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
basepath: str,
system_config: SimulationConfig,
velm_array_pkl_path: str,
job_id: str = None,
**kwargs,
):
self.pdb_id = pdb_id
Expand All @@ -64,6 +65,7 @@ def __init__(

self.intermediate_checkpoint_files = {}
self.miner_reported_energies = {}
self.job_id = job_id

def process_md_output(self) -> bool:
"""Method to process molecular dynamics data from a miner and recreate the simulation.
Expand Down Expand Up @@ -299,7 +301,7 @@ def select_stratified_checkpoints(
]
return selected

async def is_run_valid(self, validator=None, job_id=None, axon=None):
async def is_run_valid(self, validator=None, axon=None):
"""
Checks if the run is valid by evaluating a set of logical conditions:

Expand All @@ -310,7 +312,6 @@ async def is_run_valid(self, validator=None, job_id=None, axon=None):

Args:
validator: Optional validator instance to query for intermediate checkpoints
job_id: Optional job ID to pass to get_intermediate_checkpoints
axon: Optional axon to query for intermediate checkpoints

Returns:
Expand Down Expand Up @@ -342,7 +343,7 @@ async def is_run_valid(self, validator=None, job_id=None, axon=None):
return False, checked_energies_dict, miner_energies_dict, result

# Check the intermediate checkpoints
if validator is not None and job_id is not None and axon is not None:
if validator is not None and self.job_id is not None and axon is not None:
checkpoint_numbers = self.select_stratified_checkpoints(
num_checkpoints=self.number_of_checkpoints,
num_samples=c.MAX_CHECKPOINTS_TO_VALIDATE + 1, # +1 for Final
Expand All @@ -351,7 +352,7 @@ async def is_run_valid(self, validator=None, job_id=None, axon=None):
# Get intermediate checkpoints from the miner
intermediate_checkpoints = await self.get_intermediate_checkpoints(
validator=validator,
job_id=job_id,
job_id=self.job_id,
axon=axon,
checkpoint_numbers=checkpoint_numbers,
)
Expand Down Expand Up @@ -442,13 +443,12 @@ def evaluate(self) -> bool:

return True

async def validate(self, validator=None, job_id=None, axon=None):
async def validate(self, validator=None, axon=None):
"""
Validate the run by checking if it's valid and returning the appropriate metrics.

Args:
validator: Optional validator instance to query for intermediate checkpoints
job_id: Optional job ID to pass to get_intermediate_checkpoints
axon: Optional axon to query for intermediate checkpoints

Returns:
Expand All @@ -459,7 +459,7 @@ async def validate(self, validator=None, job_id=None, axon=None):
checked_energies_dict,
miner_energies_dict,
result,
) = await self.is_run_valid(validator=validator, job_id=job_id, axon=axon)
) = await self.is_run_valid(validator=validator, axon=axon)

if not is_valid:
# Return empty dictionaries to maintain consistency
Expand Down
6 changes: 2 additions & 4 deletions folding/validators/reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def evaluate(
basepath=protein.pdb_directory,
system_config=protein.system_config,
velm_array_pkl_path=protein.velm_array_pkl,
job_id=resp.job_id,
)

can_process = evaluator.evaluate()
Expand Down Expand Up @@ -183,9 +184,7 @@ async def get_energies(
checked_energies,
miner_energies,
reason,
) = await evaluator.validate(
validator=validator, job_id=job_id, axon=axon
)
) = await evaluator.validate(validator=validator, axon=axon)
else:
(
median_energy,
Expand All @@ -198,7 +197,6 @@ async def get_energies(
evaluator.final_miner_energies,
"skip",
)

# Add intermediate checkpoint files to files dictionary
for (
checkpoint_num,
Expand Down