MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / add_json_task

Function add_json_task

test/general/lm_eval/tasks/__init__.py:340–367  ·  view source on GitHub ↗

Add a JSON perplexity task if the given task name matches the JSON task specification. See `json.JsonPerplexity`.

(task_name)

Source from the content-addressed store, hash-verified

338
339
340def add_json_task(task_name):
341 """Add a JSON perplexity task if the given task name matches the
342 JSON task specification.
343
344 See `json.JsonPerplexity`.
345 """
346 if not task_name.startswith("json"):
347 return
348
349 def create_json_task():
350 splits = task_name.split("=", 1)
351 if len(splits) != 2 or not splits[1]:
352 raise ValueError(
353 "json tasks need a path argument pointing to the local "
354 "dataset, specified like this: json="
355 + _EXAMPLE_JSON_PATH
356 + ' (if there are no splits, use "train")'
357 )
358
359 json_path = splits[1]
360 if json_path == _EXAMPLE_JSON_PATH:
361 raise ValueError(
362 "please do not copy the example path directly, but substitute "
363 "it with a path to your local dataset"
364 )
365 return lambda: json.JsonPerplexity(json_path)
366
367 TASK_REGISTRY[task_name] = create_json_task()
368
369
370def get_task(task_name):

Callers 1

get_taskFunction · 0.85

Calls 1

create_json_taskFunction · 0.85

Tested by

no test coverage detected