tinygrad / tinygrad

You like pytorch? You like micrograd? You love tinygrad! ❤️
MIT License
26.69k stars 2.96k forks source link

simple retry for fetch #7189

Open Qazalin opened 6 days ago

bkmgit commented 6 days ago

Perhaps can update the code in helpers.py, to use aiohttp and asyncio

mku11 commented 6 days ago

I can help with this, though I'm not sure how it would work out with an asyncio API. Wouldn't async propagate to the caller?

Otherwise, do you want a user param with a default 1,2, or more? or a decorator if you have other net request functions that it can be applied to?

How about exponential backoff or is it getting unnecessarily complicated and moving away from being tiny? I'm assuming most of the links would be in cloud storage/APIs. If you feel net congestion is a probable case I can add a delay.

geohot commented 6 days ago

@Qazalin this is not a good first issue. On the surface it sounds like one because it's simple, but read the replies and see why it isn't.

A good first issue is something where there's pretty much one way to do it and it's easy for a person to tell themselves if they did it correctly.

Compare it to an issue like #7176

bkmgit commented 6 days ago

An example implementation is at https://github.com/Thinklab-SJTU/pygmtools/pull/73/files based on