Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

About install error under torch 1.4 or torch 1.5 #3

Closed
sunshinnnn opened this issue Nov 22, 2020 · 3 comments
Closed

About install error under torch 1.4 or torch 1.5 #3

sunshinnnn opened this issue Nov 22, 2020 · 3 comments

Comments

@sunshinnnn
Copy link

when I use torch 1.4, I can install NMR successfully by pip install external/multiperson/neural_renderer
meanwhile, i could pip install http://jasonyzhang.com/phosa_data/neural_renderer_pytorch-1.1.3-cp36-cp36m-linux_x86_64.whl,

But I will encounter the error

AttributeError Traceback (most recent call last)
in ()
8 # import neural_renderer as nr
9 import detectron2
---> 10 from detectron2.data import MetadataCatalog
11 from detectron2.structures import Boxes, BitMasks
12 from detectron2.utils.visualizer import Visualizer as PointRendVisualizer

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/detectron2/data/init.py in ()
2 from . import transforms # isort:skip
3
----> 4 from .build import (
5 build_batch_data_loader,
6 build_detection_test_loader,

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/detectron2/data/build.py in ()
10 from termcolor import colored
11
---> 12 from detectron2.structures import BoxMode
13 from detectron2.utils.comm import get_world_size
14 from detectron2.utils.env import seed_all_rng

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/detectron2/structures/init.py in ()
4
5 from .instances import Instances
----> 6 from .keypoints import Keypoints, heatmaps_to_keypoints
7 from .masks import BitMasks, PolygonMasks, rasterize_polygons_within_box, polygons_to_bitmask
8 from .rotated_boxes import RotatedBoxes

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/detectron2/structures/keypoints.py in ()
4 import torch
5
----> 6 from detectron2.layers import interpolate
7
8

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/detectron2/layers/init.py in ()
9 from .wrappers import BatchNorm2d, Conv2d, ConvTranspose2d, cat, interpolate, Linear, nonzero_tuple
10 from .blocks import CNNBlockBase
---> 11 from .aspp import ASPP
12
13 all = [k for k in globals().keys() if not k.startswith("_")]

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/detectron2/layers/aspp.py in ()
1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
2
----> 3 import fvcore.nn.weight_init as weight_init
4 import torch
5 from torch import nn

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/fvcore/nn/init.py in ()
1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
----> 2 from .activation_count import activation_count
3 from .flop_count import flop_count
4 from .focal_loss import (
5 sigmoid_focal_loss,

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/fvcore/nn/activation_count.py in ()
7 import torch.nn as nn
8
----> 9 from .jit_handles import generic_activation_jit, get_jit_model_analysis
10
11

~/anaconda3/envs/phosa2/lib/python3.6/site-packages/fvcore/nn/jit_handles.py in ()
72 # pyre-fixme[24]: Generic type typing.Callable expects 2 type parameters.
73 ops_handles: typing.Dict[str, typing.Callable],
---> 74 ) -> typing.Tuple[typing.Counter[str], typing.Counter[str]]:
75 """
76 Given a model, the inputs and the handles for each operation, return the

AttributeError: module 'typing' has no attribute 'Counter'

When I use torch 1.5,
import detectron2
from detectron2.data import MetadataCatalog
from detectron2.structures import Boxes, BitMasks
from detectron2.utils.visualizer import Visualizer as PointRendVisualizer
these import are all ok,
however, i can not install NMR successfully anymore.

Is there any way to solve such problems, whatever the import detectron2 error in torch 1.4 or NMR install error in torch 1.5

@sunshinnnn
Copy link
Author

sunshinnnn commented Nov 22, 2020

I've sloved install NMR problem under torch 1.5 by change AT_CHECK to TORCH_CHECK in all .cpp.

@monajalal
Copy link

@sunshinnnn should we use PyTorch 1.5 instead of 1.4?

@jasonyzhang
Copy link
Contributor

For people in the future who have this problem,

  • NMR out of the box only works with torch <=1.4. detectron 0.2.1 is the last version with torch 1.4 support. I've pinned these versions in the colab notebook.
  • If you want to use torch >1.4, the changes listed by @sunshinnnn will allow NMR to work with later versions of torch. This fix should work for future releases of detectron

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants