Skip to content

Commit

Permalink
Fix non-callable attributes in CachingLM
Browse files Browse the repository at this point in the history
  • Loading branch information
gakada committed Jun 13, 2023
1 parent 8cec82b commit d4889e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lm_eval/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,10 @@ def __init__(self, lm, cache_db):
lm.set_cache_hook(self.get_cache_hook())

def __getattr__(self, attr):
lm_attr = getattr(self.lm, attr)
if not callable(lm_attr):
return lm_attr

def fn(requests):
res = []
remaining_reqs = []
Expand Down
2 changes: 1 addition & 1 deletion lm_eval/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def simple_evaluate(
"model_args": model_args,
"num_fewshot": num_fewshot,
"batch_size": batch_size,
"batch_sizes": list(lm.batch_sizes.values()),
"batch_sizes": list(lm.batch_sizes.values()) if hasattr(lm, "batch_sizes") else [],
"device": device,
"no_cache": no_cache,
"limit": limit,
Expand Down

0 comments on commit d4889e1

Please sign in to comment.