Using experimental features

nwn: <p>Hello PyTorch community,</p>
<p>I’d like to use experimental functions such as torch.vmap() which are not included in the stable version, how can I do so ?</p>
<p>Best,</p>
<p>Luis</p>

ptrblck: <p>You can install the <code>Preview (nightly)</code> binaries from <a href="https://pytorch.org/get-started/locally/">here</a> to get the latest build. <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>

Blupon: <p>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 <code>torch.vmap</code> but it seems I don’t have the right nightly: I keep generating the error</p>
<blockquote>
<p>AttributeError: module ‘torch’ has no attribute ‘vmap’</p>
</blockquote>
<p>Furthermore, a</p>
<pre><code class="lang-auto">import torch
print(torch.__version__)
</code></pre>
<p>in the notebook launched with the new nightly dedicated conda env returns <code>1.7.1</code>, although the nightly should be <code>1.8.X</code> according <a href="https://discuss.pytorch.org/t/pytorch-nightly-vs-stable/105633">to this post</a>. I tried installing pytorch nightly successively with the command lines suggested on the pytorch website homepage:<br>
<code>conda install pytorch torchvision torchaudio cudatoolkit=10.1 -c pytorch-nightly</code><br>
<code>conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly</code></p>
<p>Probably unrelated but would it be linked to the <code>Remove torch.vmap</code> <a href="https://github.com/pytorch/pytorch/actions/runs/576395291" rel="noopener nofollow ugc">here</a> ? <strong>According to this <a href="https://github.com/pytorch/pytorch/issues/42368" rel="noopener nofollow ugc">github issue</a> <code>torch.vmap</code> should be available in pytorch 1.7 anyway.</strong></p>
<p>I’m calling <code>torch.vmap</code> in the following line of code, part of a class method:<br>
<code>torch.vmap(self.distance_riemann_to_c)(net_outputs)</code><br>
<code>torch.vmap</code> thus vectorizes the application of the other method (same class) <code>self.distance_riemann_to_c</code> to the batched nnet outputs <code>net_outputs</code>. Sorry if it would have been more appropriate to open a new post (?).</p>

ptrblck: <p>If <code>torch.__version__</code> returns <code>1.7.1</code>, I guess you might have multiple PyTorch installations in the current environment and your kernel picks the <code>1.7.1</code> one.<br>
Could you either uninstall other PyTorch installations or create a new environment and install the nightly there?</p>

Blupon: <aside class="quote no-group" data-username="ptrblck" data-post="4" data-topic="108359">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/48/1823_2.png" class="avatar"> ptrblck:</div>
<blockquote>
<p>Could you either uninstall other PyTorch installations or create a new environment and install the nightly there?</p>
</blockquote>
</aside>
<p>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 &amp; got the expected 1.9.0dev, and have obtained access to <code>torch.vmap()</code>. I must have done something wrong the first time ! Thanks for the quick answer <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>