Hello PyTorch community,
I’d like to use experimental functions such as torch.vmap() which are not included in the stable version, how can I do so ?
Best,
Luis
Hello PyTorch community,
I’d like to use experimental functions such as torch.vmap() which are not included in the stable version, how can I do so ?
Best,
Luis
You can install the Preview (nightly)
binaries from here to get the latest build.
Just installed pytorch-nightly in a dedicated conda env for GPU and then CPU only (since the first option didn’t work, I suspected a downgrade imposed by my cuda 10.1) in order to use torch.vmap
but it seems I don’t have the right nightly: I keep generating the error
AttributeError: module ‘torch’ has no attribute ‘vmap’
Furthermore, a
import torch
print(torch.__version__)
in the notebook launched with the new nightly dedicated conda env returns 1.7.1
, although the nightly should be 1.8.X
according to this post. I tried installing pytorch nightly successively with the command lines suggested on the pytorch website homepage:
conda install pytorch torchvision torchaudio cudatoolkit=10.1 -c pytorch-nightly
conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly
Probably unrelated but would it be linked to the Remove torch.vmap
here ? According to this github issue torch.vmap
should be available in pytorch 1.7 anyway.
I’m calling torch.vmap
in the following line of code, part of a class method:
torch.vmap(self.distance_riemann_to_c)(net_outputs)
torch.vmap
thus vectorizes the application of the other method (same class) self.distance_riemann_to_c
to the batched nnet outputs net_outputs
. Sorry if it would have been more appropriate to open a new post (?).
If torch.__version__
returns 1.7.1
, I guess you might have multiple PyTorch installations in the current environment and your kernel picks the 1.7.1
one.
Could you either uninstall other PyTorch installations or create a new environment and install the nightly there?
This is what I tried. However, today when I re-created a CPU nightly env, and a GPU nightly env, I wasn’t able to reproduce my issue & got the expected 1.9.0dev, and have obtained access to torch.vmap()
. I must have done something wrong the first time ! Thanks for the quick answer