ec436095dd
Book-CI / test (macos-latest) (push) Has been cancelled
Book-CI / test (ubuntu-latest) (push) Has been cancelled
Book-CI / test (windows-latest) (push) Has been cancelled
Release Fake Tag / publish (push) Has been cancelled
Deploy / deploy (macos-latest) (push) Has been cancelled
Deploy / deploy (ubuntu-latest) (push) Has been cancelled
Deploy / deploy (windows-latest) (push) Has been cancelled
Release to PyPI / Build & publish sglang-kt (push) Has been cancelled
Release to PyPI / Build kt-kernel (Python 3.11) (push) Has been cancelled
Release to PyPI / Build kt-kernel (Python 3.12) (push) Has been cancelled
Release to PyPI / Publish kt-kernel to PyPI (push) Has been cancelled
11 lines
446 B
Python
11 lines
446 B
Python
# reference: https://github.com/declare-lab/instruct-eval/blob/main/human_eval/main.py#L35
|
|
def filter_answer(completion: str) -> str:
|
|
# the answer is the last part of the completion, it's a int64 number
|
|
# get the last line
|
|
completion = completion.strip().split("\n")[-1]
|
|
# handle the $\\boxed{...}$ format
|
|
if "$\\boxed{" in completion:
|
|
return completion.split("}")[0].split("{")[-1]
|
|
return completion.split()[-1]
|
|
|