Skip to content

Commit 21154cb

Browse files
committed
Added LeanLineInfo to training data object
1 parent a3485cf commit 21154cb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/itp_interface/tools/training_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
TrainingDataFormat,
2222
TheoremProvingTrainingDataFormat,
2323
TrainingDataMetadataFormat)
24+
from itp_interface.tools.tactic_parser import LeanLineInfo
2425

2526
# Conditional Ray import
2627
try:
@@ -429,6 +430,9 @@ def _update_meta(self, other: TrainingDataFormat):
429430
self.meta.external_theorems_used_cnt += sum([len(goal.used_theorems_external) for goal in other.start_goals])
430431
self.meta.local_theorems_used_cnt += sum([len(goal.used_theorems_local) for goal in other.start_goals])
431432
self.meta.total_data_count += len(other.proof_steps)
433+
elif isinstance(other, LeanLineInfo):
434+
self.meta.last_training_data += 1
435+
self.meta.total_data_count += 1
432436
else:
433437
raise NotImplementedError("Meta update for this TrainingDataFormat is not implemented yet")
434438

@@ -501,6 +505,8 @@ def _clone_tdp(tdp: TrainingDataFormat, new_lemma_ref_idx: typing.List[int]) ->
501505
goal.used_theorems_external = [LemmaRefWithScore(new_lemma_ref_idx[lemma_ref.lemma_idx], lemma_ref.score) for lemma_ref in goal.used_theorems_external]
502506
goal.possible_useful_theorems_local = [LemmaRefWithScore(new_lemma_ref_idx[lemma_ref.lemma_idx], lemma_ref.score) for lemma_ref in goal.possible_useful_theorems_local]
503507
goal.possible_useful_theorems_external = [LemmaRefWithScore(new_lemma_ref_idx[lemma_ref.lemma_idx], lemma_ref.score) for lemma_ref in goal.possible_useful_theorems_external]
508+
elif isinstance(tdp, LeanLineInfo):
509+
new_tdp = copy.deepcopy(tdp)
504510
else:
505511
raise NotImplementedError("Cloning for this TrainingDataFormat is not implemented yet")
506512
return new_tdp

0 commit comments

Comments
 (0)