forked from EleutherAI/lm-evaluation-harness
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
22 additions
and
64 deletions.
There are no files selected for viewing
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import transformers | ||
import torch | ||
from ..base import LM | ||
from lm_eval.base import LM | ||
from . import MODEL_REGISTRY | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,43 @@ | ||
import argparse | ||
import json | ||
|
||
import models | ||
import tasks | ||
from lm_eval import models, tasks | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--model', required=True) | ||
parser.add_argument('--model_args', default="") | ||
parser.add_argument('--tasks', default="all_tasks") | ||
parser.add_argument('--provide_description', action="store_true") | ||
parser.add_argument('--new_fewshot', action="store_true") | ||
parser.add_argument('--num_fewshot', type=int, default=1) | ||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
model = models.get_model(args.model).create_from_arg_string(args.model_args) | ||
lm = models.get_model(args.model).create_from_arg_string(args.model_args) | ||
if args.tasks == "all_tasks": | ||
task_names = tasks.ALL_TASKS | ||
else: | ||
task_names = args.tasks.split(",") | ||
task_list = { | ||
task_dict = { | ||
task_name: tasks.get_task(task_name)() | ||
for task_name in task_names | ||
} | ||
results = {} | ||
for task_name, task in task_list: | ||
for task_name, task in task_dict.items(): | ||
if not task.has_validation_docs(): | ||
continue | ||
result = task.evaluate( | ||
docs=task.validation_docs(), | ||
lm=lm, | ||
provide_description=args.provide_description, | ||
num_fewshot=args.new_fewshot, | ||
num_fewshot=args.num_fewshot, | ||
) | ||
results[task_name] = result | ||
print(json.dumps(results, indent=2)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
main() |