Don't download BLIP model in to memory before saving; Download directly to file.
This commit is contained in:
parent
8db26171cc
commit
0d2119ea2f
|
@ -109,9 +109,9 @@ async def main(opt):
|
||||||
|
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.get(BLIP_MODEL_URL) as res:
|
async with session.get(BLIP_MODEL_URL) as res:
|
||||||
result = await res.read()
|
|
||||||
with open(model_cache_path, 'wb') as f:
|
with open(model_cache_path, 'wb') as f:
|
||||||
f.write(result)
|
async for chunk in res.content.iter_chunked(1024):
|
||||||
|
f.write(chunk)
|
||||||
print(f"Model cached to: {model_cache_path}")
|
print(f"Model cached to: {model_cache_path}")
|
||||||
else:
|
else:
|
||||||
print(f"Model already cached to: {model_cache_path}")
|
print(f"Model already cached to: {model_cache_path}")
|
||||||
|
|
Loading…
Reference in New Issue