Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

still ModuleNotFoundError: No module named 'models' #134

Closed
alicera opened this issue Jun 19, 2020 · 6 comments
Closed

still ModuleNotFoundError: No module named 'models' #134

alicera opened this issue Jun 19, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@alicera
Copy link

alicera commented Jun 19, 2020

🐛 Bug

ModuleNotFoundError: No module named 'models'

To Reproduce (REQUIRED)

Input:
python models/onnx_export.py

Output:

Traceback (most recent call last):
  File "models/onnx_export.py", line 12, in <module>
    from models.common import *
ModuleNotFoundError: No module named 'models'

Environment

docker

@alicera alicera added the bug Something isn't working label Jun 19, 2020
@dlawrences
Copy link
Contributor

dlawrences commented Jun 19, 2020

Clone the latest repository version. It includes a file named __init__.py placed in the models directory that fixes this issue.

Prolly the docker image has not been updated just yet?

Cheers

@alicera
Copy link
Author

alicera commented Jun 19, 2020

I glone the new and it is still the status

@glenn-jocher
Copy link
Member

@alicera the correct usage is displayed in the file:

"""Exports a pytorch *.pt model to *.onnx format
Usage:
import torch
$ export PYTHONPATH="$PWD" && python models/onnx_export.py --weights ./weights/yolov5s.pt --img 640 --batch 1
"""

@dlawrences if I run @alicera command I see the same error message, but this is not the intended usage, which is shown above.

@glenn-jocher
Copy link
Member

ah, I just noticed, the import torch is not needed. I've removed it in e249792

@alicera alicera closed this as completed Jun 20, 2020
@tsing90
Copy link

tsing90 commented Jun 24, 2020

I cloned the newest code, and followed the usage instruction in onnx_export.py, but still got an error:

Traceback (most recent call last):
  File "models/onnx_export.py", line 39, in <module>
    onnx.checker.check_model(model)  # check onnx model
  File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/onnx/checker.py", line 86, in check_model
    C.check_model(model.SerializeToString())
onnx.onnx_cpp2py_export.checker.ValidationError: Node () has input size 4 not in range [min=2, max=2].

==> Context: Bad node spec: input: "476" input: "496" input: "496" input: "503" output: "504" op_type: "Resize" attribute { name: "coordinate_transformation_mode" s: "asymmetric" type: STRING } attribute { name: "cubic_coeff_a" f: -0.75 type: FLOAT } attribute { name: "mode" s: "nearest" type: STRING } attribute { name: "nearest_mode" s: "floor" type: STRING }

my running command is:
export PYTHONPATH="$PWD" && python models/onnx_export.py --weights ./weights/yolov5l.pt

@glenn-jocher
Copy link
Member

@tsing90 your error is not reproducible. Try using a working environment:
https://github.com/ultralytics/yolov5#reproduce-our-environment

Screen Shot 2020-06-24 at 10 58 05 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants