Skip to content

Extra generations even if all field names are in the completion #1108

@drawal1

Description

@drawal1

Testing with Llama-3 70B, was seeing duplicate generations.

I traced it to this code in predict.py:

        for completion in completions:
            if all((completion.get(key, "") != "") for key in field_names):
                finished_completions.append(completion)
                continue
            finished_completions.append(
                extend_generation(completion, field_names, stage, max_depth, original_example),
            )

Not exactly sure why the "if" check fails incorrectly.

I fixed it by doing this:

        for completion in completions:
            extend_gen = False
            for key in field_names:
                if key not in completion:
                    extend_gen = True
                    break

            if extend_gen:
                finished_completions.append(
                    extend_generation(completion, field_names, stage, max_depth, original_example),
                )
            else:
                finished_completions.append(completion) 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions