MCPcopy Create free account
hub / github.com/InternScience/SciReason / time_limit

Function time_limit

opencompass/datasets/TheoremQA/utils.py:7–16  ·  view source on GitHub ↗
(seconds: float)

Source from the content-addressed store, hash-verified

5
6@contextlib.contextmanager
7def time_limit(seconds: float):
8 def signal_handler(signum, frame):
9 raise ValueError
10
11 signal.setitimer(signal.ITIMER_REAL, seconds)
12 signal.signal(signal.SIGALRM, signal_handler)
13 try:
14 yield
15 finally:
16 signal.setitimer(signal.ITIMER_REAL, 0)
17
18
19def extract_theoremqa_answer(pred: str, answer_flag: bool = True):

Callers 1

extract_theoremqa_answerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected