Closed maiiabocharova closed 2 years ago
You've chosen to report an unexpected problem or bug. Unless you already know the root cause of it, please include details about it by filling the issue template. The following information is missing: "Instructions To Reproduce the Issue and Full Logs";
Please show full logs as the bot asks. Environment info and reproducible instructions are also missing, but not as important for this particular issue.
Please show full logs as the bot asks. Environment info and reproducible instructions are also missing, but not as important for this particular issue.
Yes, sure, thank you a lot for replying!
To reproduce:
In colab
!pip install "git+https://github.com/facebookresearch/detectron2.git"
After that
from detectron2.export import Caffe2Tracer
ImportError Traceback (most recent call last)
[<ipython-input-11-03cc05e53570>](https://localhost:8080/#) in <module>()
----> 1 from detectron2.export import Caffe2Tracer
ImportError: cannot import name 'Caffe2Tracer' from 'detectron2.export' (/content/detectron2/detectron2/export/__init__.py)
After looking at the source code it seems to me that the issue is coming from line
from caffe2.proto import caffe2_pb2
which gives an error
ImportError Traceback (most recent call last)
[<ipython-input-2-eed119b3592c>](https://localhost:8080/#) in <module>()
----> 1 from caffe2.proto import caffe2_pb2
[/usr/local/lib/python3.7/dist-packages/caffe2/proto/__init__.py](https://localhost:8080/#) in <module>()
9 #
10 # This has to be done for all python targets, so listing them here
---> 11 from caffe2.proto import caffe2_pb2, metanet_pb2, torch_pb2
12 try:
13 from caffe2.caffe2.fb.session.proto import session_pb2
ImportError: cannot import name 'metanet_pb2' from 'caffe2.proto' (/usr/local/lib/python3.7/dist-packages/caffe2/proto/__init__.py)
And because in the init here https://github.com/facebookresearch/detectron2/blob/main/detectron2/export/__init__.py caffe2 is made optional if it gives ImportError I can not import Caffe2Tracer
I tried with several different version of torch and cuda, but I am getting this issue everywhere
In order to use Caffe2Tracer
, you obviously must install caffe2 and be able to import caffe2. Since you cannot import caffe2.proto
, import Caffe2Tracer
should fail. Therefore the failure is expected. Therefore closing.
In order to use
Caffe2Tracer
, you obviously must install caffe2 and be able to import caffe2. Since you cannot importcaffe2.proto
,import Caffe2Tracer
should fail. Therefore the failure is expected. Therefore closing.
I am very sorry that I ask such stupid questions, but how do I install it properly in colab?
Because I am able to import justcaffe2
, but not caffe2.proto
It's a very common issue and many people ask about this error. https://stackoverflow.com/questions/70252367/how-to-fix-from-caffe-proto-import-caffe-pb2-error-in-google-colab
Please, please help!
It seems here is also discussed the same issue, but I can not understand how to make it work in colab (plus my chinese is beginner-level and I do not understand how to adapt the solution provided) https://blog.csdn.net/e01528/article/details/80636867
Caffe2 is not maintained in this project (in fact it's not maintained anywhere) so we do not help with this.
It's not easy to install caffe2 in Colab today because the project has been deprecated for many years.
The best course of action is don't use Caffe2Tracer
. It's also deprecated in detectron2 as https://detectron2.readthedocs.io/en/latest/tutorials/deployment.html says
Caffe2 is not maintained in this project (in fact it's not maintained anywhere) so we do not help with this.
It's not easy to install caffe2 in Colab today because the project has been deprecated for many years.
The best course of action is don't use
Caffe2Tracer
. It's also deprecated in detectron2 as https://detectron2.readthedocs.io/en/latest/tutorials/deployment.html says
I was able to export it with tracing, thank you!!!
I have one final question, if you would be so kind to help me once again: I tried QAT from d2go. Everything went successfully and results detected are fine, but the inference speed of the trained quantized model is the same as not-quantized Here are people also mentioning the above. What could be the problem? https://github.com/facebookresearch/d2go/issues/27#issuecomment-810916224
Hello, I installed detectron2 in colab (version 2.0.6) with
!python -m pip install detectron2 -f \ https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html
But when I try
from detectron2.export import Caffe2Tracer
My import is failing
ImportError: cannot import name 'metanet_pb2' from 'caffe2.proto' (/usr/local/lib/python3.7/dist-packages/caffe2/proto/__init__.py)
I saw that people had similar issues before, but the provided solutions do not work.When I try to install it from git:
I get this error:
ImportError: cannot import name 'Caffe2Tracer' from 'detectron2.export' (/content/detectron2/detectron2/export/__init__.py)
Can you help me please? I want to export the model