Skip to content

Commit

Permalink
adding typing support for python 3.8 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
tstescoTT authored Oct 24, 2024
1 parent d8b0eba commit 398fb77
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import dataclasses
from typing import Dict, Optional, Union
from typing import Dict, Optional, Union, List

from lm_eval.tasks.ifeval import instructions_registry


@dataclasses.dataclass
class InputExample:
key: int
instruction_id_list: list[str]
instruction_id_list: List[str]
prompt: str
kwargs: list[Dict[str, Optional[Union[str, int]]]]
kwargs: List[Dict[str, Optional[Union[str, int]]]]


@dataclasses.dataclass
class OutputExample:
instruction_id_list: list[str]
instruction_id_list: List[str]
prompt: str
response: str
follow_all_instructions: bool
follow_instruction_list: list[bool]
follow_instruction_list: List[bool]


def test_instruction_following_strict(
Expand All @@ -32,7 +32,7 @@ def test_instruction_following_strict(
for index, instruction_id in enumerate(instruction_list):
instruction_cls = instructions_registry.INSTRUCTION_DICT[instruction_id]
instruction = instruction_cls(instruction_id)

# Remove None values from kwargs to avoid unexpected keyword argument errors in build_description method.
kwargs = {k: v for k, v in inp.kwargs[index].items() if v}
instruction.build_description(**kwargs)
Expand Down

0 comments on commit 398fb77

Please sign in to comment.