mirror of
https://github.com/NousResearch/atropos.git
synced 2026-04-19 12:57:58 +00:00
replace await resp.json() with await parse_http_response(resp)
This commit is contained in:
parent
a8b59ccc9b
commit
e06469f8c2
5 changed files with 52 additions and 6 deletions
|
|
@ -7,6 +7,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):
|
||||
"""
|
||||
|
|
@ -79,7 +81,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue