Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DynamicFormat that uses different SystemFormat based on size of demos list and existence of instruction. #690

Open
elronbandel opened this issue Mar 20, 2024 · 0 comments

Comments

@elronbandel
Copy link
Member

elronbandel commented Mar 20, 2024

class DynamicFormat(Format):
  few_shot_format: Format
  few_shot_with_instruction_format: Format
  zero_shot_format: Format
  zero_shot_with_instruction_format: Format
      
  def process(instance):
     has_instruction =  "instruction" not in instance or len(instance["instruction"] == 0
     has_demos =  len(instance["demos"]) == 0
     if has_demos:
         if has_instruction:
             format = self.few_shot_with_instruction_format
         else:
             format = self.few_shot_format
     else:
         if has_instruction:
            format = self.zero_shot_with_instruction_format
         else:
            format = self.zero_shot_format
     return format.process_instance(instance)
eladven added a commit that referenced this issue Mar 20, 2024
dependency in existence of instruction and num shots.

Solve issue  #690
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant