Issue
I am following a tutorial on the PyTorch website and I can't figure out what package this import uses:
from engine import train_one_epoch, evaluate
I get an error saying:
Traceback (most recent call last):
File "C:\Users\...\tv-training-code.py", line 13, in <module>
from engine import train_one_epoch, evaluate
ModuleNotFoundError: No module named 'engine'
For reference, I am using Conda to run the program and I have the latest PyTorch version installed. Any ideas for what package I need to install to make this work?
Solution
There is an obvious omission to the subject tutorial, which has caused justified confusion to others, too; this question has been raised in the Pytorch forum as well - here is the accepted answer:
In
references/detection/
, we have a number of helper functions to simplify training and evaluating detection models. Here, we will usereferences/detection/engine.py
,references/detection/utils.py
andreferences/detection/transforms.py
. Just copy them to your folder and use them here.
Essentially, the necessary steps are shown in the colab notebook accompanying the tutorial:
%%shell
# Download TorchVision repo to use some files from
# references/detection
git clone https://github.com/pytorch/vision.git
cd vision
git checkout v0.8.2
cp references/detection/utils.py ../
cp references/detection/transforms.py ../
cp references/detection/coco_eval.py ../
cp references/detection/engine.py ../
cp references/detection/coco_utils.py ../
which must be executed before you attempt to import anything from the engine
module.
Answered By - desertnaut
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.