Unverified Commit 51d6951c authored by Hailey Schoelkopf's avatar Hailey Schoelkopf Committed by GitHub
Browse files

Merge pull request #584 from gakada/perf

Fix non-callable attributes in CachingLM
parents 4c08d72a d4889e1a
...@@ -868,6 +868,10 @@ class CachingLM: ...@@ -868,6 +868,10 @@ class CachingLM:
lm.set_cache_hook(self.get_cache_hook()) lm.set_cache_hook(self.get_cache_hook())
def __getattr__(self, attr): def __getattr__(self, attr):
lm_attr = getattr(self.lm, attr)
if not callable(lm_attr):
return lm_attr
def fn(requests): def fn(requests):
res = [] res = []
remaining_reqs = [] remaining_reqs = []
......
...@@ -109,7 +109,7 @@ def simple_evaluate( ...@@ -109,7 +109,7 @@ def simple_evaluate(
"model_args": model_args, "model_args": model_args,
"num_fewshot": num_fewshot, "num_fewshot": num_fewshot,
"batch_size": batch_size, "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, "device": device,
"no_cache": no_cache, "no_cache": no_cache,
"limit": limit, "limit": limit,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment