Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'torch' has no attribute 'hub'

Tags:

pytorch

import torch
model = torch.hub.list('pytorch/vision')

My pytorch version is 1.0.0, but I can't load the hub, why is this?

like image 843
lin zhihua Avatar asked Jun 26 '19 03:06

lin zhihua


Video Answer


1 Answers

You will need torch >= 1.1.0 to use torch.hub attribute.

Alternatively, try by downloading this hub.py file and then try below code:

import hub
model = hub.list('pytorch/vision', force_reload=False)

Arguments:

github: Required, a string with format repo_owner/repo_name[:tag_name] with an optional tag/branch. The default branch is master if not specified. Example: pytorch/vision[:hub]

force_reload: Optional, whether to discard the existing cache and force a fresh download. Default is False.

like image 93
Anubhav Singh Avatar answered Oct 12 '22 19:10

Anubhav Singh