Bug of pytorch nightly?

xieydd: <p>When i use the newest version of pytorch nightly, when i  <code>from torchvision import model</code> it will be an error:</p>
<pre><code class="lang-auto">Traceback (most recent call last):
  File "train_quantization.py", line 21, in &lt;module&gt;
    from utils.eval_widerface import evaluate_widerface
  File "/opt/utils/eval_widerface.py", line 7, in &lt;module&gt;
    import torchvision.ops as ops
  File "/usr/local/lib/python3.5/dist-packages/torchvision/__init__.py", line 3, in &lt;module&gt;
    from torchvision import models
  File "/usr/local/lib/python3.5/dist-packages/torchvision/models/__init__.py", line 12, in &lt;module&gt;
    from . import detection
  File "/usr/local/lib/python3.5/dist-packages/torchvision/models/detection/__init__.py", line 1, in &lt;module&gt;
    from .faster_rcnn import *
  File "/usr/local/lib/python3.5/dist-packages/torchvision/models/detection/faster_rcnn.py", line 14, in &lt;module&gt;
    from .roi_heads import RoIHeads
  File "/usr/local/lib/python3.5/dist-packages/torchvision/models/detection/roi_heads.py", line 210, in &lt;module&gt;
    @torch.jit.script
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/__init__.py", line 1290, in script
    fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/_recursive.py", line 568, in try_compile_fn
    return torch.jit.script(fn, _rcb=rcb)
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/__init__.py", line 1290, in script
    fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/__init__.py", line 2030, in _get_overloads
    compiled_fns.append(_compile_function_with_overload(overload_fn, qual_name, obj))
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/__init__.py", line 2010, in _compile_function_with_overload
    overload_signature = torch.jit.annotations.get_signature(overload_fn, None, None, inspect.ismethod(overload_fn))
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/annotations.py", line 79, in get_signature
    signature = parse_type_line(type_line, rcb, loc)
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/annotations.py", line 165, in parse_type_line
    arg_types = [ann_to_type(ann, loc) for ann in arg_ann]
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/annotations.py", line 165, in &lt;listcomp&gt;
    arg_types = [ann_to_type(ann, loc) for ann in arg_ann]
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/annotations.py", line 303, in ann_to_type
    the_type = try_ann_to_type(ann, loc)
  File "/usr/local/lib/python3.5/dist-packages/torch/jit/annotations.py", line 296, in try_ann_to_type
    the_type = torch._C._resolve_type_from_object(ann, loc, fake_rcb)
TypeError: _resolve_type_from_object(): incompatible function arguments. The following argument types are supported:
    1. (arg0: object, arg1: torch._C._jit_tree_views.SourceRange, arg2: Callable[[str], function]) -&gt; torch._C.Type

Invoked with: typing.Union[int, NoneType], None, &lt;function try_ann_to_type.&lt;locals&gt;.fake_rcb at 0x7f654624a268&gt;

</code></pre>

xieydd: <p>Anybody help me? <img src="https://discuss.pytorch.org/images/emoji/apple/smiley.png?v=9" title=":smiley:" class="emoji" alt=":smiley:"></p>

ptrblck: <p><code>torchvision</code> doesn’t have a <code>model</code> module, so you might want to import it as:</p>
<pre><code class="lang-python">import torchvision.models as models
</code></pre>
<p>which works in the latest nightly binary (<code>0.7.0.dev20200611</code>).</p>

xieydd: <p>this is my import code <code>import torchvision.ops as ops</code>,  <code>from torchvision import models</code> is in torchvision i installed code, i am not write it. ：）</p>

ptrblck: <p>I can import both modules using the mentioned version.<br>
Did you install the nightly PyTorch version, which would correspond to the nightly torchvision?</p>