YJiangcm/Lion

problem in generate_hard_instruction.py

Opened this issue · 2 comments

in function post_process_gpt3_response

    instruction_match = re.search(r"Instruction: (.+)\n", raw_instructions)
    if instruction_match:
        instruction = instruction_match.group(1)
    else:
        return []

raw_instructions is the response of chatgpt.
And it uses string like Instruction: xx\nInput: <noinput>\n\n#Created Prompt# to call gpt to generate new instruction.
But it seems that it won't contain Instruction: in the gpt response, only the new instruction. So it will allways return [] and cause while loop never stop.

Is there a problem or not? @YJiangcm

Hi, in most cases, the gpt response contains strings like Instruction: xxx\nInput: xxx. So we use re.search(r"Instruction: (.+)\n", raw_instructions) to extract the generated instruction.

However, in some cases, the response will not contain the string Instruction: and Input: , so we discard the generated rsponse by return []. Hope this addresses your concerns.

@YJiangcm
I think maybe the prompt Instruction: xx\nInput: <noinput>\n\n#Created Prompt# to the gpt is not directly( I have tried times, but can't response as except). Maybe update the prompt like ask it to generate new prompt as your format is more helpful.