AttributeError: 'torch.distributed.rpc.Future' object has no attribute 'then'


I am trying to use then method that is explained here along with rpc_async. Yet, I get this error:
AttributeError: ‘torch.distributed.rpc.Future’ object has no attribute ‘then’

I tried just importing torch.futures.Future and I got also an error:
ModuleNotFoundError: No module named ‘torch.futures’

Yet, importing torch.distributed.rpc.Future works. But, the imported class does not have a constructor, where running inspect.getmembers(Future, predicate=inspect.isfunction) gives an empty array.

I have the latest torch version (1.5.1).

Would you please help me with this issue?


Hey @aguirguis, the torch.futures package is introduced as an experimental feature in v1.6. If you use the nightly binary or compile from master, the then API should be there.

Sorry, we should have mentioned that it is only available for v1.6+