Unverified Commit 07e5348c authored by Rob Geada's avatar Rob Geada Committed by GitHub
Browse files

Log tokenized request warning only once (#3002)

* Log tokenized request warning only once

* Fix logging for concurrent usecase as well
parent 81fc0826
......@@ -597,6 +597,10 @@ class TemplateAPI(TemplateLM):
chunked = re_ord.get_batched(
n=self._batch_size if self._concurrent <= 1 else 0, batch_fn=None
)
if not self.tokenized_requests:
eval_logger.info(
"Tokenized requests are disabled. Context + generation length is not checked."
)
if self._concurrent <= 1:
pbar = tqdm(desc="Requesting API", total=len(requests))
for chunk in chunked:
......@@ -615,10 +619,7 @@ class TemplateAPI(TemplateLM):
eval_logger.warning(
f"Some contexts exceeded (max length: ({self.max_length}) - max_gen_toks: ({max_gen_toks}). They were left truncated."
)
else:
eval_logger.info(
"Tokenized requests are disabled. Context + generation length is not checked."
)
req = encodings_list if self.tokenized_requests else contexts
outputs = retry(
stop=stop_after_attempt(self.max_retries),
......@@ -664,10 +665,7 @@ class TemplateAPI(TemplateLM):
eval_logger.warning(
f"Some contexts exceeded (max length: ({self.max_length}) - max_gen_toks ({max_gen_toks}). They were left truncated."
)
else:
eval_logger.info(
"Tokenized requests are disabled. Context + generation length is not checked."
)
req = encodings_list if self.tokenized_requests else contexts
results = itertools.chain.from_iterable(
asyncio.run(
......
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