Skip to content

Commit

Permalink
First pass at a fix for guidance-ai#863
Browse files Browse the repository at this point in the history
  • Loading branch information
hudson-ai committed Jun 1, 2024
1 parent c009b1a commit 6037242
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion guidance/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,13 @@ def _record_captures_from_root(self, initial_item, data, log_prob_data):

def _compute_parse_tree(self, initial_pos, initial_item, reversed_state_sets):
stack = [(initial_pos, initial_item)]
seen = set()

while stack:
pos, item = stack.pop()

if (pos, item) in seen:
# Skip items we have already processed
continue
# compute the children for this item
assert self._compute_children(pos, item, reversed_state_sets)

Expand Down

0 comments on commit 6037242

Please sign in to comment.