Unverified Commit 602abceb authored by yurodiviy's avatar yurodiviy Committed by GitHub
Browse files

Add non-programmatic BIG-bench-hard tasks (#406)



* Support bigbench-hard json tasks using multiple_choice_grade

* Add support for greedy decoding in bigbench tasks

* move bigbench_resources to datasets

* rectify changes to rf.greedy_until w upstream

* make path to resource import reflect new location

---------
Co-authored-by: default avatarhaileyschoelkopf <hailey.schoelkopf@yale.edu>
parent e47e01be
...@@ -342,18 +342,25 @@ class BaseLM(LM): ...@@ -342,18 +342,25 @@ class BaseLM(LM):
re_ord = utils.Reorderer(requests, _collate) re_ord = utils.Reorderer(requests, _collate)
for context, until in tqdm(re_ord.get_reordered()): for context, request_args in tqdm(re_ord.get_reordered()):
until = request_args['until']
if isinstance(until, str): if isinstance(until, str):
until = [until] until = [until]
if until:
(primary_until,) = self.tok_encode(until[0]) (primary_until,) = self.tok_encode(until[0])
else:
primary_until = None
context_enc = torch.tensor( context_enc = torch.tensor(
[self.tok_encode(context)[self.max_gen_toks - self.max_length :]] [self.tok_encode(context)[self.max_gen_toks - self.max_length :]]
).to(self.device) ).to(self.device)
max_gen_tokens = min(
self.max_gen_toks, request_args.get('max_length', self.max_gen_toks)
)
cont = self._model_generate( cont = self._model_generate(
context_enc, context_enc.shape[1] + self.max_gen_toks, primary_until context_enc, context_enc.shape[1] + max_gen_tokens, primary_until
) )
s = self.tok_decode(cont[0].tolist()[context_enc.shape[1] :]) s = self.tok_decode(cont[0].tolist()[context_enc.shape[1] :])
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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