Skip to content

Commit

Permalink
handle None
Browse files Browse the repository at this point in the history
  • Loading branch information
baberabb committed Jan 17, 2025
1 parent 2b56339 commit 46cb513
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lm_eval/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import re
from dataclasses import asdict, is_dataclass
from itertools import islice
from typing import Any, Callable, Generator, List, Tuple
from typing import Any, Callable, Generator, List, Optional, Tuple

import numpy as np
import yaml
Expand Down Expand Up @@ -93,12 +93,14 @@ def sanitize_list(sub):
return str(sub)


def simple_parse_args_string(args_string):
def simple_parse_args_string(args_string: Optional[str]) -> dict:
"""
Parses something like
args1=val1,arg2=val2
Into a dictionary
"""
if args_string is None:
return {}
args_string = args_string.strip()
if not args_string:
return {}
Expand Down

0 comments on commit 46cb513

Please sign in to comment.