* e7f754e 2021-09-17 | use tempfile to avoid name conflict (HEAD -> master, tag: v0.8.33) [Ge Yang]
python
def load_torch(self, *keys, path=None, map_location=None, **kwargs):
import torch, tempfile
path = pJoin(*keys, path)
if path.lower().startswith('s3://'):
postfix = os.path.basename(path)
with tempfile.NamedTemporaryFile(suffix=f'.{postfix}') as ntp:
self.download_s3(path[5:], to=ntp.name)
return torch.load(ntp, map_location=map_location, **kwargs)
else:
fn_or_buff = self.load_file(path)
return torch.load(fn_or_buff, map_location=map_location, **kwargs)