replace await resp.json() with await parse_http_response(resp)

This commit is contained in:
hjc-puro 2025-05-03 06:36:05 -04:00
parent a8b59ccc9b
commit e06469f8c2
5 changed files with 52 additions and 6 deletions

View file

@ -8,6 +8,8 @@ import jsonlines
from tqdm.asyncio import tqdm # Import tqdm for async
from transformers import AutoTokenizer
from atroposlib.utils.io import parse_http_response
def find_common_prefix(strings):
"""
@ -80,7 +82,7 @@ async def check_for_batch(api_url):
while True:
async with aiohttp.ClientSession() as session:
async with session.get(f"{api_url}/batch") as response:
data = await response.json()
data = await parse_http_response(response)
if data["batch"] is not None:
return data["batch"]
await asyncio.sleep(1) # Wait before polling again