euagendas / m3inference

A deep learning system for demographic inference (gender, age, and individual/person) that was trained on massive Twitter dataset using profile images, screen names, names, and biographies
http://www.euagendas.org
GNU Affero General Public License v3.0
145 stars 57 forks source link

Incompatibility with Torch 1.7.0 #12

Closed Turux closed 3 years ago

Turux commented 3 years ago

Hi there,

On a new installation pip will attempt to pull the latest version of all the dependency. Since Torch released the latest version of their package (1.7.0) M3 inference seems to misbehave. I get the following error when attempting to import the preprocessing package.

AttributeError: module 'torch.utils.data' has no attribute "'BatchSamplerDistributedSamplerDataset'"

The whole issue is resolved by downgrading Torch to version 1.6.0.

I hope this helps! Keep up with the amazing work!

PS: For context I tried this on two OS with two different Python version and got the same result. Test 1: Linux 5.4.0-1031-azure; Python 3.6.7-1 Test 2: Linux 5.4.39-linuxkit; Python 3.8.2-0 Both are running on x86_64 architecture

zijwang commented 3 years ago

Thanks for bringing this up, @Turux. I confirmed that the current version does not work with torch v1.7. This seems to be a PyTorch issue as the following line will trigger the error without m3inference:

from torch.utils.data import *

I tried the nightly version of PyTorch (v1.8 preview) following https://pytorch.org/ and that works. If you need torch v.1.7+ features, you may try to use the nightly version. I will make a PR soon to update the wildcard import in the codebase, which should fix the issue.

zijwang commented 3 years ago

I created a PR that should fix the issue. Could you take a look to see whether that works on your end?

Turux commented 3 years ago

Thank you very much for the prompt response!

I just tried your PR in a container and it works!